From b54224351f17c7a7a7c328b8750e810c05252054 Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Mon, 29 Jan 2024 17:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A9=B1=E9=87=87=E8=A1=A8?= =?UTF-8?q?=E7=8A=B6=E6=80=81bit=E7=BC=96=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consts/bit.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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