Browse Source

Merge pull request #2866 in CORE/base-third from feature/10.0 to research/10.0

* commit '2a499938bfcafb7bd430255ac49cb2c475ea9f75':
  REPORT-55330 修复Bitmap实现bug
research/10.0
superman 3 years ago
parent
commit
9d744cf498
  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