From 18097a52c46cd7732519b288b9e1c78379739b18 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 8 Jun 2017 18:26:27 -0700 Subject: [PATCH] gcs: explicitly optimize inner loop of gcs filter computation --- gcs/gcs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcs/gcs.go b/gcs/gcs.go index 1a20794..b186bec 100644 --- a/gcs/gcs.go +++ b/gcs/gcs.go @@ -93,11 +93,11 @@ func BuildGCSFilter(P uint8, key [KeySize]byte, data [][]byte) (*Filter, error) for _, v := range values { // Calculate the difference between this value and the last, // modulo P. - remainder = (v - lastValue) % f.modulusP + remainder = (v - lastValue) & (f.modulusP - 1) // Calculate the difference between this value and the last, // divided by P. - value = (v - lastValue - remainder) / f.modulusP + value = (v - lastValue - remainder) >> f.p lastValue = v // Write the P multiple into the bitstream in unary; the