From be3d8758f3abeac07cbfd6cf80e3f2d3b4c3ad78 Mon Sep 17 00:00:00 2001 From: loy Date: Thu, 15 Jul 2021 15:59:20 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55330=20=E4=BF=AE=E5=A4=8DBitmap?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fine-roaringbitmap/src/main/java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java b/fine-roaringbitmap/src/main/java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java index 146848602..0c0dc875e 100644 --- a/fine-roaringbitmap/src/main/java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java +++ b/fine-roaringbitmap/src/main/java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java @@ -65,7 +65,7 @@ public class RoaringBitmap { int lenDiff = 0; if (sIdx1 > 0) { byte b = value[sIdx0 - 1]; - byte b2 = (byte) (~(b & 0xff) >> sIdx1 << sIdx1 + ((b & 0xff) << (32 - sIdx1) >> (32 - sIdx1))); + byte b2 = (byte) (b ^ (0xff - (int) Math.pow(2, eIdx1) + 1)); value[sIdx0 - 1] = b2; lenDiff += countInByte(b2) - countInByte(b); } @@ -75,7 +75,7 @@ public class RoaringBitmap { } if (eIdx1 > 0) { byte b = value[eIdx0]; - byte b2 = (byte) (((b & 0xff) >> eIdx1 << eIdx1) + ~(b & 0xff) << (32 - eIdx1) >> (32 - eIdx1)); + byte b2 = (byte) (b ^ ((int) Math.pow(2, eIdx1) - 1)); value[eIdx0] = b2; lenDiff += countInByte(b2) - countInByte(b); }