mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
fix(ccint): make sure hash is always positive
This commit is contained in:
parent
6eab4269f1
commit
da2abe6e60
1 changed files with 1 additions and 1 deletions
|
|
@ -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 =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue