From 6df283c3795bac58ccfa9a86b2e3fbdf073fdefd Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 17 Jul 2023 17:52:59 -0400 Subject: [PATCH] Always increment by full popcount instead of two halves when splitting byte --- src/singeli/src/slash.singeli | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/singeli/src/slash.singeli b/src/singeli/src/slash.singeli index 8af48000..2bc8e3f2 100644 --- a/src/singeli/src/slash.singeli +++ b/src/singeli/src/slash.singeli @@ -264,21 +264,22 @@ fn slash{c, T & hasarch{'AVX2'} & (if (T==i32) use_table else T==i64)}(wp:*u64, {j} => { v:=i+VT~~j; i+=ii; v } } def tab = if (tw==32) itab else i64tab - def step{w} = { - pc := popc{w} + def step{r, w} = { ind := load{tab, w}; def I = type{ind} s := sel{[16]i8, V~~[width{V}/width{I}]I**ind, expander} if (tw==64) s |= make{V, iota{8}%2} store{*V~~r, 0, from_ind{s}} - r+= pc } @for_special_buffered{r,8} (w in *u8~~wp to sum) { + pc := popc{w} if (tw==32) { - step{w} + step{r,w} } else { - step{w&0xf} - step{w>>4} + h := w&0xf + step{r, h} + step{r+popcRand{h}, w>>4} } + r += pc } }