Browse Source

Pull request #2860: REPORT-55330 修复Bitmap实现bug

Merge in CORE/base-third from ~LOY/base-third:feature/10.0 to feature/10.0

* commit 'be3d8758f3abeac07cbfd6cf80e3f2d3b4c3ad78':
  REPORT-55330 修复Bitmap实现bug
feature/10.0
loy 3 years ago
parent
commit
0f881d8450
  1. 4
      fine-roaringbitmap/src/main/java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java

4
fine-roaringbitmap/src/main/java/com/fr/third/bitmap/roaringbitmap/RoaringBitmap.java

@ -65,7 +65,7 @@ public class RoaringBitmap {
int lenDiff = 0; int lenDiff = 0;
if (sIdx1 > 0) { if (sIdx1 > 0) {
byte b = value[sIdx0 - 1]; 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; value[sIdx0 - 1] = b2;
lenDiff += countInByte(b2) - countInByte(b); lenDiff += countInByte(b2) - countInByte(b);
} }
@ -75,7 +75,7 @@ public class RoaringBitmap {
} }
if (eIdx1 > 0) { if (eIdx1 > 0) {
byte b = value[eIdx0]; 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; value[eIdx0] = b2;
lenDiff += countInByte(b2) - countInByte(b); lenDiff += countInByte(b2) - countInByte(b);
} }

Loading…
Cancel
Save