Commit graph

6 commits

Author SHA1 Message Date
Simon Cruanes
2827011b37 ocamlformat 2026-02-17 02:19:04 +00:00
Simon Cruanes
5a50d42352 CCInt64.hash: migrate to C stub, add tests
Replace the pure-OCaml FNV-1 implementation in CCInt64 with C stubs
that call the same cc_fnv_hash_int64 core as CCInt.hash:

- hash: int64 -> int via caml_cc_hash_int64 ([@unboxed] + [@@noalloc])
- hash_to_int64: int64 -> int64 via new caml_cc_hash_int64_to_int64
  entry points (masks result to non-negative, needs caml_copy_int64
  for bytecode so cannot be [@@noalloc])

Add 18 tests in t_int64.ml covering:
- Non-negativity of hash and hash_to_int64
- Consistency between hash and hash_to_int64
- Different inputs produce different hashes
- Determinism
- QuickCheck: hash is non-negative for random inputs
2026-02-16 23:58:49 +00:00
Simon Cruanes
91cc585d5f
fix (#485) 2026-02-09 21:16:31 -05:00
Simon Cruanes
3dd63964fb
Merge branch 'master' into ccbv_bytes2 2022-07-04 14:35:25 -04:00
Simon Cruanes
10865eaced reformat 2022-07-04 13:36:06 -04:00
Simon Cruanes
b695918e99
move all core tests to new testlib 2022-07-02 00:29:25 -04:00