diff --git a/consts/bit.go b/consts/bit.go index 6500464..729bdaa 100644 --- a/consts/bit.go +++ b/consts/bit.go @@ -28,9 +28,9 @@ func SetBitOfBytes(bs []byte, bitIndex int, v bool) []byte { } by := bs[bi] if v { - by |= (1 << (7 - i)) + by |= (1 << i) } else { - by &= ((1 << (7 - i)) ^ byte(0xff)) + by &= ((1 << i) ^ byte(0xff)) } bs[bi] = by return bs