package grenier

  1. Overview
  2. Docs
A collection of various algorithms in OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

grenier-v0.12.tbz
sha256=b08e4c774ef72fc53c4fcee477e739d1beac9702079300daddf51ced9fa9cd26
sha512=984d92c51dac7b3f169cad595969a4fdbeb2be7b420ed1a85618d6adbb64af855cf2618d9bd0834e84d6734b99196944cab04435e1aeacad8cdfbc9a7f73d6d4

doc/src/grenier.jmphash/jmphash.ml.html

Source file jmphash.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
let hash_k = Int64.(shift_left 1L 31)

let rec jmp_hash j n key =
  let key = Int64.(succ (mul key 2862933555777941757L)) in
  let key' = Int64.(succ (shift_right_logical key 33)) in
  let a = Int64.succ j in
  let j' = Int64.(div (mul a hash_k) key') in
  if j' >= Int64.of_int n then
    j
  else
    jmp_hash j' n key

let host ~hosts key =
  Int64.to_int (jmp_hash 0L hosts key)
OCaml

Innovation. Community. Security.