package eqaf
Constant-time equal function on string
Install
Dune Dependency
Authors
Maintainers
Sources
eqaf-v0.3.tbz
sha256=59b55d797599657e21f8f9e71f6cbfe2669c39d14d958eabf4aecd6ef9c9ff20
sha512=42aed53726195c90bc52d085e6a8ba25c839d4be6a88efe8572ae510713643fafaeba0e743b14ab09bf1bfb8a0749ff74b93dac1bce65e03087a3a2cccfd6839
doc/src/eqaf.bigstring/eqaf_bigstring.ml.html
Source file eqaf_bigstring.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
type bigstring = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t let length x = Bigarray.Array1.dim x [@@inline] external int : bigstring -> int -> int = "%caml_ba_ref_1" [@@noalloc] external int32 : bigstring -> int -> int32 = "%caml_bigstring_get32u" let equal a b = let len = (min : int -> int -> int) (length a) (length b) in let res0 = ref 0l in let res1 = ref 0 in let len0 = len land 3 in let len1 = len asr 2 in for i = 0 to pred len1 do let i = i * 4 in res0 := Int32.logor !res0 (Int32.logxor (int32 a i) (int32 a i)) done ; for i = 0 to pred len0 do let i = len1 * 4 + i in res1 := !res1 lor (int a i lxor int b i) ; done ; length a = length b && !res0 = 0l && !res1 = 0
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>