From 6ed57ede6a8aec1625f498cac5e5a75af6f45f5d Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Thu, 30 Jan 2020 15:18:54 -0800 Subject: [PATCH] Fix small bug in RLE Thanks @frrist Signed-off-by: Jakub Sztandera --- lib/rlepluslazy/bitvec.go | 2 +- lib/rlepluslazy/runs.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rlepluslazy/bitvec.go b/lib/rlepluslazy/bitvec.go index e442c09c4..0aca2578f 100644 --- a/lib/rlepluslazy/bitvec.go +++ b/lib/rlepluslazy/bitvec.go @@ -84,7 +84,7 @@ func (bv *wbitvec) Out() []byte { } if bv.bitCap > 8 { // if we store some needed bits in second byte, save them also - bv.buf = append(bv.buf, byte(bv.bitCap>>8)) + bv.buf = append(bv.buf, byte(bv.bits>>8)) bv.index++ bv.bits = bv.bits - 8 } diff --git a/lib/rlepluslazy/runs.go b/lib/rlepluslazy/runs.go index 034a449c9..bbf4c4f08 100644 --- a/lib/rlepluslazy/runs.go +++ b/lib/rlepluslazy/runs.go @@ -8,8 +8,8 @@ import ( func Sum(a, b RunIterator) (RunIterator, error) { it := addIt{a: a, b: b} - it.prep() - return &it, nil + + return &it, it.prep() } type addIt struct {