Use binary literals for xor chunk encoding

An opinionated cosmetic change, but since go 1.13 we have this fancy
0b.... literals so we don't need to write hex and comment the binary
value.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
This commit is contained in:
Oleg Zaytsev 2021-07-05 16:39:24 +02:00
parent 263847e64a
commit 40126a8494
No known key found for this signature in database
GPG key ID: 7E9FE9FD48F512EF

View file

@ -178,16 +178,16 @@ func (a *xorAppender) Append(t int64, v float64) {
case dod == 0:
a.b.writeBit(zero)
case bitRange(dod, 14):
a.b.writeBits(0x02, 2) // '10'
a.b.writeBits(0b10, 2)
a.b.writeBits(uint64(dod), 14)
case bitRange(dod, 17):
a.b.writeBits(0x06, 3) // '110'
a.b.writeBits(0b110, 3)
a.b.writeBits(uint64(dod), 17)
case bitRange(dod, 20):
a.b.writeBits(0x0e, 4) // '1110'
a.b.writeBits(0b1110, 4)
a.b.writeBits(uint64(dod), 20)
default:
a.b.writeBits(0x0f, 4) // '1111'
a.b.writeBits(0b1111, 4)
a.b.writeBits(uint64(dod), 64)
}
@ -344,15 +344,15 @@ func (it *xorIterator) Next() bool {
var sz uint8
var dod int64
switch d {
case 0x00:
case 0b0:
// dod == 0
case 0x02:
case 0b10:
sz = 14
case 0x06:
case 0b110:
sz = 17
case 0x0e:
case 0b1110:
sz = 20
case 0x0f:
case 0b1111:
// Do not use fast because it's very unlikely it will succeed.
bits, err := it.br.readBits(64)
if err != nil {