gcs: explicitly optimize inner loop of gcs filter computation
This commit is contained in:
parent
c26776fe48
commit
18097a52c4
1 changed files with 2 additions and 2 deletions
|
@ -93,11 +93,11 @@ func BuildGCSFilter(P uint8, key [KeySize]byte, data [][]byte) (*Filter, error)
|
||||||
for _, v := range values {
|
for _, v := range values {
|
||||||
// Calculate the difference between this value and the last,
|
// Calculate the difference between this value and the last,
|
||||||
// modulo P.
|
// modulo P.
|
||||||
remainder = (v - lastValue) % f.modulusP
|
remainder = (v - lastValue) & (f.modulusP - 1)
|
||||||
|
|
||||||
// Calculate the difference between this value and the last,
|
// Calculate the difference between this value and the last,
|
||||||
// divided by P.
|
// divided by P.
|
||||||
value = (v - lastValue - remainder) / f.modulusP
|
value = (v - lastValue - remainder) >> f.p
|
||||||
lastValue = v
|
lastValue = v
|
||||||
|
|
||||||
// Write the P multiple into the bitstream in unary; the
|
// Write the P multiple into the bitstream in unary; the
|
||||||
|
|
Loading…
Reference in a new issue