From 7717cc13db0f320f6dcf481af040e55ee14af35e Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 3 Apr 2021 00:57:41 -0400 Subject: [PATCH] fix(ccint): make sure hash is always positive --- src/core/CCInt.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/CCInt.ml b/src/core/CCInt.ml index 8f8f6bfd..b789e30a 100644 --- a/src/core/CCInt.ml +++ b/src/core/CCInt.ml @@ -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 =