fix(ccint): make sure hash is always positive

This commit is contained in:
Simon Cruanes 2021-04-03 00:57:41 -04:00
parent 6eab4269f1
commit da2abe6e60

View file

@ -49,7 +49,7 @@ let hash (n:int) : int =
(* h := h xor (k-th bit of n) *)
h := Int64.(logxor !h (of_int ((n lsr (k * 8)) land 0xff)));
done;
Int64.to_int !h (* truncate back to int *)
(Int64.to_int !h) land max_int (* truncate back to int and remove sign *)
let range i j yield =
let rec up i j yield =