From 75aed91f32a1c389be8d91dcb27922c3c0a64eba Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 5 Nov 2023 15:46:11 -0500 Subject: [PATCH] And max offset of 8 by testing two vectors --- src/singeli/src/search.singeli | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/singeli/src/search.singeli b/src/singeli/src/search.singeli index 83f9f612..4b8ec4c3 100644 --- a/src/singeli/src/search.singeli +++ b/src/singeli/src/search.singeli @@ -522,16 +522,21 @@ def try_vec_memb{T, hash, hashlen, sh, maxh, has_maxh, rp, fp, n, done @for (rp, fp over _ from u*l to n) rp = promote{R, homAny{test{fp}}} goto{done} } - if (max_off < vl) { - hp := *V~~(hash + maxh>>sh) - hv := load{hp} - store{hp, 0, hv &~ (hv == V**(maxh &- ~has_maxh))} - def test{x} = { - h := hash_val{x}; j := h>>sh - V**h == load{*V~~(hash+j), 0} + def try{nv} = { + if (max_off < nv*vl) { + # Avoid matching maxh if it shouldn't be in the table + clear := V**(maxh &- ~has_maxh) + @for (hv in *V~~(hash + maxh>>sh) over vl) hv = hv &~ (hv == clear) + # Test against nv vectors + def test{x} = { + h := hash_val{x}; vh := V**h + def any{{...r,a}} = any{r}|a; def any{{a}}=a + any{@collect (k in *V~~(hash+h>>sh) over nv) vh == k} + } + memb{test} } - memb{test} } + each{try, tup{1,2}} } def exp_hash{T, name} = {