File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,10 @@ let fold_domain f b acc =
265
265
in
266
266
fold_domain_aux 0 b acc
267
267
268
- (* simple propagator: only compute known low bits *)
268
+ (* simple propagator: only compute known low bits
269
+
270
+ Example: ???100 * ???000 = ?00000 (trailing zeroes accumulate)
271
+ ???111 * ????11 = ????01 (min of low bits known) *)
269
272
let mul a b =
270
273
let sz = width a in
271
274
assert (width b = sz);
@@ -278,6 +281,7 @@ let mul a b =
278
281
if zeroes_a + zeroes_b > = sz then
279
282
exact sz Z. zero ex
280
283
else
284
+ (* Factor out the low zeroes *)
281
285
let low_bits =
282
286
if zeroes_a + zeroes_b = 0 then empty
283
287
else exact (zeroes_a + zeroes_b) Z. zero ex
@@ -286,7 +290,10 @@ let mul a b =
286
290
assert (width a + width low_bits = sz);
287
291
let b = extract b zeroes_b (zeroes_b + sz - width low_bits - 1 ) in
288
292
assert (width b + width low_bits = sz);
289
- (* ((ah * 2^n) + al) * ((bh * 2^m) + bl) =
293
+ (* a = ah * 2^n + al (0 <= al < 2^n)
294
+ b = bh * 2^m + bl (0 <= bl < 2^m)
295
+
296
+ ((ah * 2^n) + al) * ((bh * 2^m) + bl) =
290
297
al * bl (mod 2^(min n m)) *)
291
298
let low_a_known = Z. trailing_zeros @@ Z. lognot @@ bits_known a in
292
299
let low_b_known = Z. trailing_zeros @@ Z. lognot @@ bits_known b in
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ val logxor : t -> t -> t
119
119
(* * Bitwise xor. *)
120
120
121
121
val mul : t -> t -> t
122
- (* * Multiplication . *)
122
+ (* * Integer multiplication . *)
123
123
124
124
val concat : t -> t -> t
125
125
(* * Bit-vector concatenation. *)
Original file line number Diff line number Diff line change @@ -409,8 +409,8 @@ end = struct
409
409
410
410
let propagate_less_than ~ex ~strict dx dy =
411
411
let open Interval_domains.Ephemeral in
412
- (* Do not use [update] to make sure that the justification is only stored on
413
- the upper/lower bound. *)
412
+ (* Add justification prior to calling [update] to ensure that it is only
413
+ stored on the appropriate bound. *)
414
414
update ~ex: Ex. empty dx (less_than_sup ~ex ~strict !! dy);
415
415
update ~ex: Ex. empty dy (greater_than_inf ~ex ~strict !! dx)
416
416
You can’t perform that action at this time.
0 commit comments