nus-yam/ex-repair huggingface dataset:
Program: 90209
Project: 90209
Buggy source:
/** 
 * @deprecated use the version where longs specify the range. Negative values not allowed for rangeStart and rangeEnd
 */
@Deprecated public static RoaringBitmap xor(@SuppressWarnings("String_Node_Str") final Iterator bitmaps,final int rangeStart,final int rangeEnd){
  return xor(bitmaps,(long)rangeStart,(long)rangeEnd);
}

Fixed version (ground truth):
/** 
 * Computes XOR between input bitmaps in the given range, from rangeStart (inclusive) to rangeEnd (exclusive)
 * @param bitmaps input bitmaps, these are not modified
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 * @return new result bi
 * @deprecated use the version where longs specify the range. Negative values not allowed for rangeStart and rangeEnd
 */
@Deprecated public static RoaringBitmap xor(@SuppressWarnings("String_Node_Str") final Iterator bitmaps,final int rangeStart,final int rangeEnd){
  return xor(bitmaps,(long)rangeStart,(long)rangeEnd);
}
Program: 90210
Project: 90210
Buggy source:
/** 
 * @deprecated use the version where longs specify the range
 */
@Deprecated public void flip(final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    flip((long)rangeStart,(long)rangeEnd);
  }
  flip(rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}

Fixed version (ground truth):
/** 
 * Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 * @deprecated use the version where longs specify the range
 */
@Deprecated public void flip(final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    flip((long)rangeStart,(long)rangeEnd);
  }
  flip(rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}
Program: 90211
Project: 90211
Buggy source:
/** 
 * @deprecated use the version where longs specify the range. Negative range points are forbidden.
 */
@Deprecated public static RoaringBitmap or(@SuppressWarnings("String_Node_Str") final Iterator bitmaps,final int rangeStart,final int rangeEnd){
  return or(bitmaps,(long)rangeStart,(long)rangeEnd);
}

Fixed version (ground truth):
/** 
 * Computes OR between input bitmaps in the given range, from rangeStart (inclusive) to rangeEnd (exclusive)
 * @param bitmaps input bitmaps, these are not modified
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 * @return new result bitmap 
 * @deprecated use the version where longs specify the range. Negative range points are forbidden.
 */
@Deprecated public static RoaringBitmap or(@SuppressWarnings("String_Node_Str") final Iterator bitmaps,final int rangeStart,final int rangeEnd){
  return or(bitmaps,(long)rangeStart,(long)rangeEnd);
}
Program: 90212
Project: 90212
Buggy source:
/** 
 * Hamming weight of the 64-bit words involved in the range start, start+1,..., end-1
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 */
public static int cardinalityInBitmapWordRange(long[] bitmap,int start,int end){
  if (start == end) {
    return 0;
  }
  int firstword=start / 64;
  int endword=(end - 1) / 64;
  int answer=0;
  for (int i=firstword; i <= endword; i++) {
    answer+=Long.bitCount(bitmap[i]);
  }
  return answer;
}

Fixed version (ground truth):
/** 
 * Hamming weight of the 64-bit words involved in the range start, start+1,..., end-1
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 * @return the hamming weight
 */
public static int cardinalityInBitmapWordRange(long[] bitmap,int start,int end){
  if (start == end) {
    return 0;
  }
  int firstword=start / 64;
  int endword=(end - 1) / 64;
  int answer=0;
  for (int i=firstword; i <= endword; i++) {
    answer+=Long.bitCount(bitmap[i]);
  }
  return answer;
}
Program: 90213
Project: 90213
Buggy source:
/** 
 * set bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 */
public static int setBitmapRangeAndCardinalityChange(long[] bitmap,int start,int end){
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  setBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}

Fixed version (ground truth):
/** 
 * set bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 * @return cardinality change
 */
public static int setBitmapRangeAndCardinalityChange(long[] bitmap,int start,int end){
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  setBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}
Program: 90214
Project: 90214
Buggy source:
/** 
 * reset  bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 */
public static int resetBitmapRangeAndCardinalityChange(long[] bitmap,int start,int end){
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  resetBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}

Fixed version (ground truth):
/** 
 * reset  bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 * @return cardinality change
 */
public static int resetBitmapRangeAndCardinalityChange(long[] bitmap,int start,int end){
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  resetBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}
Program: 90215
Project: 90215
Buggy source:
/** 
 * flip  bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 */
public static int flipBitmapRangeAndCardinalityChange(long[] bitmap,int start,int end){
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  flipBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}

Fixed version (ground truth):
/** 
 * flip  bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 * @return cardinality change
 */
public static int flipBitmapRangeAndCardinalityChange(long[] bitmap,int start,int end){
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  flipBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}
Program: 90216
Project: 90216
Buggy source:
/** 
 * set bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 */
public static int setBitmapRangeAndCardinalityChange(LongBuffer bitmap,int start,int end){
  if (BufferUtil.isBackedBySimpleArray(bitmap)) {
    return Util.setBitmapRangeAndCardinalityChange(bitmap.array(),start,end);
  }
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  setBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}

Fixed version (ground truth):
/** 
 * set bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 * @return cardinality change
 */
public static int setBitmapRangeAndCardinalityChange(LongBuffer bitmap,int start,int end){
  if (BufferUtil.isBackedBySimpleArray(bitmap)) {
    return Util.setBitmapRangeAndCardinalityChange(bitmap.array(),start,end);
  }
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  setBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}
Program: 90217
Project: 90217
Buggy source:
/** 
 * reset bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 */
public static int resetBitmapRangeAndCardinalityChange(LongBuffer bitmap,int start,int end){
  if (BufferUtil.isBackedBySimpleArray(bitmap)) {
    return Util.resetBitmapRangeAndCardinalityChange(bitmap.array(),start,end);
  }
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  resetBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}

Fixed version (ground truth):
/** 
 * reset bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 * @return cardinality change
 */
public static int resetBitmapRangeAndCardinalityChange(LongBuffer bitmap,int start,int end){
  if (BufferUtil.isBackedBySimpleArray(bitmap)) {
    return Util.resetBitmapRangeAndCardinalityChange(bitmap.array(),start,end);
  }
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  resetBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}
Program: 90218
Project: 90218
Buggy source:
/** 
 * flip bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 */
public static int flipBitmapRangeAndCardinalityChange(LongBuffer bitmap,int start,int end){
  if (BufferUtil.isBackedBySimpleArray(bitmap)) {
    return Util.flipBitmapRangeAndCardinalityChange(bitmap.array(),start,end);
  }
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  flipBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}

Fixed version (ground truth):
/** 
 * flip bits at start, start+1,..., end-1 and report the cardinality change
 * @param bitmap array of words to be modified
 * @param start first index to be modified (inclusive)
 * @param end last index to be modified (exclusive)
 * @return cardinality change
 */
public static int flipBitmapRangeAndCardinalityChange(LongBuffer bitmap,int start,int end){
  if (BufferUtil.isBackedBySimpleArray(bitmap)) {
    return Util.flipBitmapRangeAndCardinalityChange(bitmap.array(),start,end);
  }
  int cardbefore=cardinalityInBitmapWordRange(bitmap,start,end);
  flipBitmapRange(bitmap,start,end);
  int cardafter=cardinalityInBitmapWordRange(bitmap,start,end);
  return cardafter - cardbefore;
}
Program: 90219
Project: 90219
Buggy source:
/** 
 * @deprecated use the version where longs specify the range
 */
@Deprecated public static MutableRoaringBitmap flip(ImmutableRoaringBitmap bm,final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    return flip(bm,(long)rangeStart,(long)rangeEnd);
  }
  return flip(bm,rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}

Fixed version (ground truth):
/** 
 * Complements the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive). The given bitmap is unchanged.
 * @param bm bitmap being negated
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 * @return a new Bitmap
 * @deprecated use the version where longs specify the range
 */
@Deprecated public static MutableRoaringBitmap flip(ImmutableRoaringBitmap bm,final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    return flip(bm,(long)rangeStart,(long)rangeEnd);
  }
  return flip(bm,rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}
Program: 90220
Project: 90220
Buggy source:
/** 
 * @deprecated use the version where longs specify the range. Negative range points are forbidden.
 */
@Deprecated public static MutableRoaringBitmap or(@SuppressWarnings("String_Node_Str") final Iterator bitmaps,final int rangeStart,final int rangeEnd){
  return or(bitmaps,(long)rangeStart,(long)rangeEnd);
}

Fixed version (ground truth):
/** 
 * Computes OR between input bitmaps in the given range, from rangeStart (inclusive) to rangeEnd (exclusive)
 * @param bitmaps input bitmaps, these are not modified
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 * @return new result bitmap
 * @deprecated use the version where longs specify the range. Negative range points are forbidden.
 */
@Deprecated public static MutableRoaringBitmap or(@SuppressWarnings("String_Node_Str") final Iterator bitmaps,final int rangeStart,final int rangeEnd){
  return or(bitmaps,(long)rangeStart,(long)rangeEnd);
}
Program: 90221
Project: 90221
Buggy source:
/** 
 * @deprecated use the version where longs specify the range
 */
@Deprecated public void remove(final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    remove((long)rangeStart,(long)rangeEnd);
  }
  remove(rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}

Fixed version (ground truth):
/** 
 * Remove from the current bitmap all integers in [rangeStart,rangeEnd).
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 * @deprecated use the version where longs specify the range
 */
@Deprecated public void remove(final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    remove((long)rangeStart,(long)rangeEnd);
  }
  remove(rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}
Program: 90222
Project: 90222
Buggy source:
/** 
 * @deprecated use the version where longs specify the range
 */
@Deprecated public void flip(final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    flip((long)rangeStart,(long)rangeEnd);
  }
  flip(rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}

Fixed version (ground truth):
/** 
 * Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 * @deprecated use the version where longs specify the range
 */
@Deprecated public void flip(final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    flip((long)rangeStart,(long)rangeEnd);
  }
  flip(rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}
Program: 90223
Project: 90223
Buggy source:
/** 
 * @deprecated use the version where longs specify the range
 */
@Deprecated public void add(final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    add((long)rangeStart,(long)rangeEnd);
  }
  add(rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}

Fixed version (ground truth):
/** 
 * Add to the current bitmap all integers in [rangeStart,rangeEnd).
 * @param rangeStart inclusive beginning of range
 * @param rangeEnd exclusive ending of range
 * @deprecated use the version where longs specify the range
 */
@Deprecated public void add(final int rangeStart,final int rangeEnd){
  if (rangeStart >= 0) {
    add((long)rangeStart,(long)rangeEnd);
  }
  add(rangeStart & 0xFFFFFFFFL,rangeEnd & 0xFFFFFFFFL);
}
Program: 90224
Project: 90224
Buggy source:
/** 
 * Creates an instance that is ready for iteration.
 * @param r bitmap to be iterated over
 */
public ReverseIntIteratorFlyweight(RoaringBitmap r){
}

Fixed version (ground truth):
/** 
 * Creates an instance that is ready for iteration.
 * @param r bitmap to be iterated over
 */
public ReverseIntIteratorFlyweight(RoaringBitmap r){
  wrap(r);
}
Program: 90225
Project: 90225
Buggy source:
/** 
 * Creates an instance that is ready for iteration.
 * @param r bitmap to be iterated over
 */
public BufferReverseIntIteratorFlyweight(ImmutableRoaringBitmap r){
}

Fixed version (ground truth):
/** 
 * Creates an instance that is ready for iteration.
 * @param r bitmap to be iterated over
 */
public BufferReverseIntIteratorFlyweight(ImmutableRoaringBitmap r){
  wrap(r);
}
Program: 90226
Project: 90226
Buggy source:
private static int[] takeSortedAndDistinct(Random source,int count){
  LinkedHashSet<Integer> ints=new LinkedHashSet<Integer>(count);
  for (int size=0; size < count; size++) {
    int next;
    do {
      next=Math.abs(source.nextInt());
    }
 while (!ints.add(next));
  }
  int[] unboxed=Ints.toArray(ints);
  Arrays.sort(unboxed);
  return unboxed;
}

Fixed version (ground truth):
private static int[] takeSortedAndDistinct(Random source,int count){
  LinkedHashSet<Integer> ints=new LinkedHashSet<Integer>(count);
  for (int size=0; size < count; size++) {
    int next;
    do {
      next=Math.abs(source.nextInt());
    }
 while (!ints.add(next));
  }
  for (int k=1000; k < 10000; ++k) {
    if (!ints.contains(k))     ints.add(k);
  }
  int[] unboxed=Ints.toArray(ints);
  Arrays.sort(unboxed);
  return unboxed;
}
Program: 90227
Project: 90227
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testPriorityQueueXor(){
  int[] array1={1232,3324,123,43243,1322,7897,8767};
  int[] array2={39173,39174,39175,39176,39177,39178,39179};
  int[] array3={1232,3324,123,43243,1322,7897,8767,39173,39174,39175,39176,39177,39178,39179};
  MutableRoaringBitmap data1=MutableRoaringBitmap.bitmapOf(array1);
  MutableRoaringBitmap data2=MutableRoaringBitmap.bitmapOf(array2);
  MutableRoaringBitmap data3=MutableRoaringBitmap.bitmapOf(array3);
  Assert.assertEquals(data3,BufferFastAggregation.priorityqueue_xor(data1,data2));
  BufferFastAggregation.priorityqueue_xor(data1);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testPriorityQueueXor(){
  int[] array1={1232,3324,123,43243,1322,7897,8767};
  int[] array2={39173,39174,39175,39176,39177,39178,39179};
  int[] array3={1232,3324,123,43243,1322,7897,8767,39173,39174,39175,39176,39177,39178,39179};
  ImmutableRoaringBitmap data1=MutableRoaringBitmap.bitmapOf(array1);
  ImmutableRoaringBitmap data2=MutableRoaringBitmap.bitmapOf(array2);
  ImmutableRoaringBitmap data3=MutableRoaringBitmap.bitmapOf(array3);
  Assert.assertEquals(data3,BufferFastAggregation.priorityqueue_xor(data1,data2));
  BufferFastAggregation.priorityqueue_xor(data1);
}
Program: 90228
Project: 90228
Buggy source:
private static int[] takeSortedAndDistinct(Random source,int count){
  LinkedHashSet<Integer> ints=new LinkedHashSet<Integer>(count);
  for (int size=0; size < count; size++) {
    int next;
    do {
      next=Math.abs(source.nextInt());
    }
 while (!ints.add(next));
  }
  int[] unboxed=Ints.toArray(ints);
  Arrays.sort(unboxed);
  return unboxed;
}

Fixed version (ground truth):
private static int[] takeSortedAndDistinct(Random source,int count){
  LinkedHashSet<Integer> ints=new LinkedHashSet<Integer>(count);
  for (int size=0; size < count; size++) {
    int next;
    do {
      next=Math.abs(source.nextInt());
    }
 while (!ints.add(next));
  }
  for (int k=1000; k < 10000; ++k) {
    if (!ints.contains(k))     ints.add(k);
  }
  int[] unboxed=Ints.toArray(ints);
  Arrays.sort(unboxed);
  return unboxed;
}
Program: 90229
Project: 90229
Buggy source:
public static ImmutableRoaringBitmap toMapped(MutableRoaringBitmap r){
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  DataOutputStream dos=new DataOutputStream(bos);
  try {
    r.serialize(dos);
    dos.close();
  }
 catch (  IOException e) {
    throw new RuntimeException(e.toString());
  }
  ByteBuffer bb=ByteBuffer.wrap(bos.toByteArray());
  return new ImmutableRoaringBitmap(bb);
}

Fixed version (ground truth):
private static ImmutableRoaringBitmap toMapped(MutableRoaringBitmap r){
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  DataOutputStream dos=new DataOutputStream(bos);
  try {
    r.serialize(dos);
    dos.close();
  }
 catch (  IOException e) {
    throw new RuntimeException(e.toString());
  }
  ByteBuffer bb=ByteBuffer.wrap(bos.toByteArray());
  return new ImmutableRoaringBitmap(bb);
}
Program: 90230
Project: 90230
Buggy source:
/** 
 * Return the set values as an array, if the cardinality is smaller than 1<<31.  The integer values are in sorted order.
 * @return array representing the set values.
 */
@Override public int[] toArray(){
  final int[] array=new int[(int)this.getCardinality()];
  int pos=0, pos2=0;
  while (pos < this.highLowContainer.size()) {
    final int hs=this.highLowContainer.getKeyAtIndex(pos) << 16;
    Container c=this.highLowContainer.getContainerAtIndex(pos++);
    c.fillLeastSignificant16bits(array,pos2,hs);
    pos2+=c.getCardinality();
  }
  return array;
}

Fixed version (ground truth):
/** 
 * Return the set values as an array, if the cardinality is smaller than 2147483648.  The integer values are in sorted order.
 * @return array representing the set values.
 */
@Override public int[] toArray(){
  final int[] array=new int[(int)this.getCardinality()];
  int pos=0, pos2=0;
  while (pos < this.highLowContainer.size()) {
    final int hs=this.highLowContainer.getKeyAtIndex(pos) << 16;
    Container c=this.highLowContainer.getContainerAtIndex(pos++);
    c.fillLeastSignificant16bits(array,pos2,hs);
    pos2+=c.getCardinality();
  }
  return array;
}
Program: 90231
Project: 90231
Buggy source:
/** 
 * Return the set values as an array if the cardinality is less  than 1<<31. The integer values are in sorted order.
 * @return array representing the set values.
 */
@Override public int[] toArray(){
  final int[] array=new int[(int)this.getCardinality()];
  int pos=0, pos2=0;
  while (pos < this.highLowContainer.size()) {
    final int hs=BufferUtil.toIntUnsigned(this.highLowContainer.getKeyAtIndex(pos)) << 16;
    final MappeableContainer c=this.highLowContainer.getContainerAtIndex(pos++);
    c.fillLeastSignificant16bits(array,pos2,hs);
    pos2+=c.getCardinality();
  }
  return array;
}

Fixed version (ground truth):
/** 
 * Return the set values as an array if the cardinality is less  than 2147483648. The integer values are in sorted order.
 * @return array representing the set values.
 */
@Override public int[] toArray(){
  final int[] array=new int[(int)this.getCardinality()];
  int pos=0, pos2=0;
  while (pos < this.highLowContainer.size()) {
    final int hs=BufferUtil.toIntUnsigned(this.highLowContainer.getKeyAtIndex(pos)) << 16;
    final MappeableContainer c=this.highLowContainer.getContainerAtIndex(pos++);
    c.fillLeastSignificant16bits(array,pos2,hs);
    pos2+=c.getCardinality();
  }
  return array;
}
Program: 90232
Project: 90232
Buggy source:
@Override public Container not(final int firstOfRange,final int lastOfRange){
  return not(new BitmapContainer(),firstOfRange,lastOfRange);
}

Fixed version (ground truth):
@Override public Container not(final int firstOfRange,final int lastOfRange){
  BitmapContainer answer=clone();
  answer.cardinality+=Util.flipBitmapRangeAndCardinalityChange(answer.bitmap,firstOfRange,lastOfRange);
  if (answer.cardinality <= ArrayContainer.DEFAULT_MAX_SIZE)   return answer.toArrayContainer();
  return answer;
}
Program: 90233
Project: 90233
Buggy source:
@Override public Container inot(final int firstOfRange,final int lastOfRange){
  return not(this,firstOfRange,lastOfRange);
}

Fixed version (ground truth):
@Override public Container inot(final int firstOfRange,final int lastOfRange){
  cardinality+=Util.flipBitmapRangeAndCardinalityChange(bitmap,firstOfRange,lastOfRange);
  if (cardinality <= ArrayContainer.DEFAULT_MAX_SIZE)   return toArrayContainer();
  return this;
}
Program: 90234
Project: 90234
Buggy source:
/** 
 * Extracts the values in the specified range, rangeStart (inclusive) and rangeEnd (exclusive) while avoiding copies as much as possible.
 * @param rb input bitmap
 * @param rangeStart inclusive
 * @param rangeEnd exclusive
 * @return new bitmap
 */
static MutableRoaringBitmap selectRangeWithoutCopy(ImmutableRoaringBitmap rb,final int rangeStart,final int rangeEnd){
}

Fixed version (ground truth):
/** 
 * Extracts the values in the specified range, rangeStart (inclusive) and rangeEnd (exclusive) while avoiding copies as much as possible.
 * @param rb input bitmap
 * @param rangeStart inclusive
 * @param rangeEnd exclusive
 * @return new bitmap
 */
private static MutableRoaringBitmap selectRangeWithoutCopy(ImmutableRoaringBitmap rb,final int rangeStart,final int rangeEnd){
}
Program: 90235
Project: 90235
Buggy source:
/** 
 * Extracts the values in the specified range, rangeStart (inclusive) and rangeEnd (exclusive) while avoiding copies as much as possible.
 * @param rb input bitmap
 * @param rangeStart inclusive
 * @param rangeEnd exclusive
 * @return new bitmap
 */
private static MutableRoaringBitmap selectRangeWithoutCopy(ImmutableRoaringBitmap rb,final int rangeStart,final int rangeEnd){
}

Fixed version (ground truth):
/** 
 * Extracts the values in the specified range, rangeStart (inclusive) and rangeEnd (exclusive) while avoiding copies as much as possible.
 * @param rb input bitmap
 * @param rangeStart inclusive
 * @param rangeEnd exclusive
 * @return new bitmap
 */
static MutableRoaringBitmap selectRangeWithoutCopy(ImmutableRoaringBitmap rb,final int rangeStart,final int rangeEnd){
}
Program: 90236
Project: 90236
Buggy source:
@Override public int hashCode(){
  MappeableContainerPointer cp=this.getContainerPointer();
  int hashvalue=0;
  while (cp.hasContainer()) {
    int th=cp.key() * 0xF0F0F0 + cp.getContainer().hashCode();
    hashvalue=31 * hashvalue + th;
  }
  return hashvalue;
}

Fixed version (ground truth):
@Override public int hashCode(){
  MappeableContainerPointer cp=this.getContainerPointer();
  int hashvalue=0;
  while (cp.hasContainer()) {
    int th=cp.key() * 0xF0F0F0 + cp.getContainer().hashCode();
    hashvalue=31 * hashvalue + th;
    cp.advance();
  }
  return hashvalue;
}
Program: 90238
Project: 90238
Buggy source:
/** 
 * Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected. The resulting container may not track its cardinality correctly. This can be fixed as follows:   if(c.getCardinality()&lt;0) ((MappeableBitmapContainer)c).computeCardinality();
 * @param x other container
 * @return aggregated container
 */
public MappeableContainer lazyOR(MappeableContainer x){
  if (this instanceof MappeableArrayContainer) {
    if (x instanceof MappeableArrayContainer)     return or((MappeableArrayContainer)x);
 else     if (x instanceof MappeableBitmapContainer)     return ((MappeableBitmapContainer)x).lazyor((MappeableArrayContainer)this);
    return ((MappeableRunContainer)x).lazyor((MappeableArrayContainer)this);
  }
 else   if (this instanceof MappeableRunContainer) {
    if (x instanceof MappeableArrayContainer)     return ((MappeableRunContainer)this).ilazyor((MappeableArrayContainer)x);
 else     if (x instanceof MappeableBitmapContainer)     return ((MappeableBitmapContainer)x).lazyor((MappeableRunContainer)this);
    return or((MappeableRunContainer)x);
  }
 else {
    if (x instanceof MappeableArrayContainer)     return ((MappeableBitmapContainer)this).lazyor((MappeableArrayContainer)x);
 else     if (x instanceof MappeableBitmapContainer)     return ((MappeableBitmapContainer)this).lazyor((MappeableBitmapContainer)x);
    return ((MappeableBitmapContainer)this).lazyor((MappeableRunContainer)x);
  }
}

Fixed version (ground truth):
/** 
 * Computes the bitwise OR of this container with another (union). This container as well as the provided container are left unaffected. The resulting container may not track its cardinality correctly. This can be fixed as follows:   if(c.getCardinality()&lt;0) ((MappeableBitmapContainer)c).computeCardinality();
 * @param x other container
 * @return aggregated container
 */
public MappeableContainer lazyOR(MappeableContainer x){
  if (this instanceof MappeableArrayContainer) {
    if (x instanceof MappeableArrayContainer)     return or((MappeableArrayContainer)x);
 else     if (x instanceof MappeableBitmapContainer)     return ((MappeableBitmapContainer)x).lazyor((MappeableArrayContainer)this);
    return ((MappeableRunContainer)x).lazyor((MappeableArrayContainer)this);
  }
 else   if (this instanceof MappeableRunContainer) {
    if (x instanceof MappeableArrayContainer)     return ((MappeableRunContainer)this).lazyor((MappeableArrayContainer)x);
 else     if (x instanceof MappeableBitmapContainer)     return ((MappeableBitmapContainer)x).lazyor((MappeableRunContainer)this);
    return or((MappeableRunContainer)x);
  }
 else {
    if (x instanceof MappeableArrayContainer)     return ((MappeableBitmapContainer)this).lazyor((MappeableArrayContainer)x);
 else     if (x instanceof MappeableBitmapContainer)     return ((MappeableBitmapContainer)this).lazyor((MappeableBitmapContainer)x);
    return ((MappeableBitmapContainer)this).lazyor((MappeableRunContainer)x);
  }
}
Program: 90240
Project: 90240
Buggy source:
private Container ilazyorToRun(ArrayContainer x){
  if (isFull())   return this.clone();
  final int nbrruns=this.nbrruns;
  final int offset=Math.max(nbrruns,x.getCardinality());
  ensureCapacity(offset + nbrruns);
  copyValuesLength(this.valueslength,0,this.valueslength,offset,nbrruns);
  int rlepos=0;
  this.nbrruns=0;
  PeekableShortIterator i=(PeekableShortIterator)x.getShortIterator();
  while (i.hasNext() && (rlepos < nbrruns)) {
    if (Util.compareUnsigned(getValue(rlepos + offset),i.peekNext()) <= 0) {
      smartAppend(getValue(rlepos + offset),getLength(rlepos + offset));
      rlepos++;
    }
 else {
      smartAppend(i.next());
    }
  }
  if (i.hasNext()) {
    if (this.nbrruns > 0) {
      int lastval=Util.toIntUnsigned(getValue(nbrruns + offset)) + Util.toIntUnsigned(getLength(nbrruns + offset)) + 1;
      i.advanceIfNeeded((short)lastval);
    }
    while (i.hasNext()) {
      smartAppend(i.next());
    }
  }
 else {
    while (rlepos < nbrruns) {
      smartAppend(getValue(rlepos + offset),getLength(rlepos + offset));
      rlepos++;
    }
  }
  return convertToLazyBitmapIfNeeded();
}

Fixed version (ground truth):
private Container ilazyorToRun(ArrayContainer x){
  if (isFull())   return this.clone();
  final int nbrruns=this.nbrruns;
  final int offset=Math.max(nbrruns,x.getCardinality());
  ensureCapacity(offset + nbrruns);
  copyValuesLength(this.valueslength,0,this.valueslength,offset,nbrruns);
  int rlepos=0;
  this.nbrruns=0;
  PeekableShortIterator i=(PeekableShortIterator)x.getShortIterator();
  while (i.hasNext() && (rlepos < nbrruns)) {
    if (Util.compareUnsigned(getValue(rlepos + offset),i.peekNext()) <= 0) {
      smartAppend(getValue(rlepos + offset),getLength(rlepos + offset));
      rlepos++;
    }
 else {
      smartAppend(i.next());
    }
  }
  if (i.hasNext()) {
    if (this.nbrruns > 0) {
      int lastval=Util.toIntUnsigned(getValue(nbrruns + offset - 1)) + Util.toIntUnsigned(getLength(nbrruns + offset - 1)) + 1;
      i.advanceIfNeeded((short)lastval);
    }
    while (i.hasNext()) {
      smartAppend(i.next());
    }
  }
 else {
    while (rlepos < nbrruns) {
      smartAppend(getValue(rlepos + offset),getLength(rlepos + offset));
      rlepos++;
    }
  }
  return convertToLazyBitmapIfNeeded();
}
Program: 90241
Project: 90241
Buggy source:
private Container lazyorToRun(ArrayContainer x){
  if (isFull())   return this.clone();
  RunContainer answer=new RunContainer(0,new short[2 * (this.nbrruns + x.getCardinality())]);
  int rlepos=0;
  PeekableShortIterator i=(PeekableShortIterator)x.getShortIterator();
  while (i.hasNext() && (rlepos < this.nbrruns)) {
    if (Util.compareUnsigned(getValue(rlepos),i.peekNext()) <= 0) {
      answer.smartAppend(getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
 else {
      answer.smartAppend(i.next());
    }
  }
  if (i.hasNext()) {
    if (answer.nbrruns > 0) {
      int lastval=Util.toIntUnsigned(answer.getValue(answer.nbrruns)) + Util.toIntUnsigned(answer.getLength(answer.nbrruns)) + 1;
      i.advanceIfNeeded((short)lastval);
    }
    while (i.hasNext()) {
      answer.smartAppend(i.next());
    }
  }
 else {
    while (rlepos < this.nbrruns) {
      answer.smartAppend(getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
  }
  return answer.convertToLazyBitmapIfNeeded();
}

Fixed version (ground truth):
private Container lazyorToRun(ArrayContainer x){
  if (isFull())   return this.clone();
  RunContainer answer=new RunContainer(0,new short[2 * (this.nbrruns + x.getCardinality())]);
  int rlepos=0;
  PeekableShortIterator i=(PeekableShortIterator)x.getShortIterator();
  while (i.hasNext() && (rlepos < this.nbrruns)) {
    if (Util.compareUnsigned(getValue(rlepos),i.peekNext()) <= 0) {
      answer.smartAppend(getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
 else {
      answer.smartAppend(i.next());
    }
  }
  if (i.hasNext()) {
    if (answer.nbrruns > 0) {
      int lastval=Util.toIntUnsigned(answer.getValue(answer.nbrruns - 1)) + Util.toIntUnsigned(answer.getLength(answer.nbrruns - 1)) + 1;
      i.advanceIfNeeded((short)lastval);
    }
    while (i.hasNext()) {
      answer.smartAppend(i.next());
    }
  }
 else {
    while (rlepos < this.nbrruns) {
      answer.smartAppend(getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
  }
  return answer.convertToLazyBitmapIfNeeded();
}
Program: 90242
Project: 90242
Buggy source:
private MappeableContainer lazyorToRun(MappeableArrayContainer x){
  if (isFull())   return this.clone();
  MappeableRunContainer answer=new MappeableRunContainer(0,ShortBuffer.allocate(2 * (this.nbrruns + x.getCardinality())));
  short[] vl=answer.valueslength.array();
  int rlepos=0;
  PeekableShortIterator i=(PeekableShortIterator)x.getShortIterator();
  while ((rlepos < this.nbrruns) && i.hasNext()) {
    if (BufferUtil.compareUnsigned(getValue(rlepos),i.peekNext()) <= 0) {
      answer.smartAppend(vl,getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
 else {
      answer.smartAppend(vl,i.next());
    }
  }
  if (i.hasNext()) {
    if (answer.nbrruns > 0) {
      int lastval=BufferUtil.toIntUnsigned(answer.getValue(answer.nbrruns)) + BufferUtil.toIntUnsigned(answer.getLength(answer.nbrruns)) + 1;
      i.advanceIfNeeded((short)lastval);
    }
    while (i.hasNext()) {
      answer.smartAppend(vl,i.next());
    }
  }
 else {
    while (rlepos < this.nbrruns) {
      answer.smartAppend(vl,getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
  }
  return answer.convertToLazyBitmapIfNeeded();
}

Fixed version (ground truth):
private MappeableContainer lazyorToRun(MappeableArrayContainer x){
  if (isFull())   return this.clone();
  MappeableRunContainer answer=new MappeableRunContainer(0,ShortBuffer.allocate(2 * (this.nbrruns + x.getCardinality())));
  short[] vl=answer.valueslength.array();
  int rlepos=0;
  PeekableShortIterator i=(PeekableShortIterator)x.getShortIterator();
  while ((rlepos < this.nbrruns) && i.hasNext()) {
    if (BufferUtil.compareUnsigned(getValue(rlepos),i.peekNext()) <= 0) {
      answer.smartAppend(vl,getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
 else {
      answer.smartAppend(vl,i.next());
    }
  }
  if (i.hasNext()) {
    if (answer.nbrruns > 0) {
      int lastval=BufferUtil.toIntUnsigned(answer.getValue(answer.nbrruns - 1)) + BufferUtil.toIntUnsigned(answer.getLength(answer.nbrruns - 1)) + 1;
      i.advanceIfNeeded((short)lastval);
    }
    while (i.hasNext()) {
      answer.smartAppend(vl,i.next());
    }
  }
 else {
    while (rlepos < this.nbrruns) {
      answer.smartAppend(vl,getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
  }
  return answer.convertToLazyBitmapIfNeeded();
}
Program: 90243
Project: 90243
Buggy source:
@Setup public void setup() throws Exception {
  ZipRealDataRetriever dataRetriever=new ZipRealDataRetriever(dataset);
  System.out.println();
  System.out.println("String_Node_Str" + dataRetriever.getName());
  ArrayList<MutableRoaringBitmap> tmpac=new ArrayList<MutableRoaringBitmap>();
  ArrayList<MutableRoaringBitmap> tmprc=new ArrayList<MutableRoaringBitmap>();
  ArrayList<ConciseSet> tmpcc=new ArrayList<ConciseSet>();
  ArrayList<EWAHCompressedBitmap> tmpewah=new ArrayList<EWAHCompressedBitmap>();
  ArrayList<EWAHCompressedBitmap32> tmpewah32=new ArrayList<EWAHCompressedBitmap32>();
  for (  int[] data : dataRetriever.fetchBitPositions()) {
    MutableRoaringBitmap mbasic=MutableRoaringBitmap.bitmapOf(data);
    MutableRoaringBitmap mopti=mbasic.clone();
    mopti.runOptimize();
    if (!mopti.equals(mbasic))     throw new RuntimeException("String_Node_Str");
    ConciseSet concise=toConcise(data);
    tmpac.add(mbasic);
    tmprc.add(mopti);
    tmpcc.add(concise);
    tmpewah.add(EWAHCompressedBitmap.bitmapOf(data));
    tmpewah32.add(EWAHCompressedBitmap32.bitmapOf(data));
  }
  mrc=convertToImmutableRoaring(tmprc);
  mac=convertToImmutableRoaring(tmpac);
  cc=convertToImmutableConcise(tmpcc);
  ewah=convertToImmutableEWAH(tmpewah);
  ewah32=convertToImmutableEWAH32(tmpewah32);
  if ((mrc.size() != mac.size()) || (mac.size() != cc.size()))   throw new RuntimeException("String_Node_Str");
  expectedvalue=BufferFastAggregation.naive_or(limit(count,mrc.iterator())).getCardinality();
}

Fixed version (ground truth):
@Setup public void setup() throws Exception {
  ZipRealDataRetriever dataRetriever=new ZipRealDataRetriever(dataset);
  System.out.println();
  System.out.println("String_Node_Str" + dataRetriever.getName());
  ArrayList<MutableRoaringBitmap> tmpac=new ArrayList<MutableRoaringBitmap>();
  ArrayList<MutableRoaringBitmap> tmprc=new ArrayList<MutableRoaringBitmap>();
  ArrayList<ConciseSet> tmpcc=new ArrayList<ConciseSet>();
  ArrayList<EWAHCompressedBitmap> tmpewah=new ArrayList<EWAHCompressedBitmap>();
  ArrayList<EWAHCompressedBitmap32> tmpewah32=new ArrayList<EWAHCompressedBitmap32>();
  for (  int[] data : dataRetriever.fetchBitPositions()) {
    MutableRoaringBitmap mbasic=MutableRoaringBitmap.bitmapOf(data);
    MutableRoaringBitmap mopti=mbasic.clone();
    mopti.runOptimize();
    if (!mopti.equals(mbasic))     throw new RuntimeException("String_Node_Str");
    ConciseSet concise=toConcise(data);
    tmpac.add(mbasic);
    tmprc.add(mopti);
    tmpcc.add(concise);
    tmpewah.add(EWAHCompressedBitmap.bitmapOf(data));
    tmpewah32.add(EWAHCompressedBitmap32.bitmapOf(data));
  }
  System.out.println("String_Node_Str" + count + "String_Node_Str"+ tmpac.size());
  mrc=convertToImmutableRoaring(tmprc);
  mac=convertToImmutableRoaring(tmpac);
  cc=convertToImmutableConcise(tmpcc);
  ewah=convertToImmutableEWAH(tmpewah);
  ewah32=convertToImmutableEWAH32(tmpewah32);
  if ((mrc.size() != mac.size()) || (mac.size() != cc.size()))   throw new RuntimeException("String_Node_Str");
  expectedvalue=BufferFastAggregation.naive_or(limit(count,mrc.iterator())).getCardinality();
}
Program: 90244
Project: 90244
Buggy source:
protected void lazyor(final RoaringBitmap x2){
  int pos1=0, pos2=0;
  int length1=highLowContainer.size();
  final int length2=x2.highLowContainer.size();
  main:   if (pos1 < length1 && pos2 < length2) {
    short s1=highLowContainer.getKeyAtIndex(pos1);
    short s2=x2.highLowContainer.getKeyAtIndex(pos2);
    while (true) {
      if (s1 == s2) {
        this.highLowContainer.setContainerAtIndex(pos1,highLowContainer.getContainerAtIndex(pos1).lazyIOR(x2.highLowContainer.getContainerAtIndex(pos2)));
        pos1++;
        pos2++;
        if ((pos1 == length1) || (pos2 == length2)) {
          break main;
        }
        s1=highLowContainer.getKeyAtIndex(pos1);
        s2=x2.highLowContainer.getKeyAtIndex(pos2);
      }
 else       if (Util.compareUnsigned(s1,s2) < 0) {
        pos1++;
        if (pos1 == length1) {
          break main;
        }
        s1=highLowContainer.getKeyAtIndex(pos1);
      }
 else {
        highLowContainer.insertNewKeyValueAt(pos1,s2,x2.highLowContainer.getContainerAtIndex(pos2));
        pos1++;
        length1++;
        pos2++;
        if (pos2 == length2) {
          break main;
        }
        s2=x2.highLowContainer.getKeyAtIndex(pos2);
      }
    }
  }
  if (pos1 == length1) {
    highLowContainer.appendCopy(x2.highLowContainer,pos2,length2);
  }
}

Fixed version (ground truth):
protected void lazyor(final RoaringBitmap x2){
  int pos1=0, pos2=0;
  int length1=highLowContainer.size();
  final int length2=x2.highLowContainer.size();
  main:   if (pos1 < length1 && pos2 < length2) {
    short s1=highLowContainer.getKeyAtIndex(pos1);
    short s2=x2.highLowContainer.getKeyAtIndex(pos2);
    while (true) {
      if (s1 == s2) {
        this.highLowContainer.setContainerAtIndex(pos1,highLowContainer.getContainerAtIndex(pos1).lazyIOR(x2.highLowContainer.getContainerAtIndex(pos2)));
        pos1++;
        pos2++;
        if ((pos1 == length1) || (pos2 == length2)) {
          break main;
        }
        s1=highLowContainer.getKeyAtIndex(pos1);
        s2=x2.highLowContainer.getKeyAtIndex(pos2);
      }
 else       if (Util.compareUnsigned(s1,s2) < 0) {
        pos1++;
        if (pos1 == length1) {
          break main;
        }
        s1=highLowContainer.getKeyAtIndex(pos1);
      }
 else {
        highLowContainer.insertNewKeyValueAt(pos1,s2,x2.highLowContainer.getContainerAtIndex(pos2).clone());
        pos1++;
        length1++;
        pos2++;
        if (pos2 == length2) {
          break main;
        }
        s2=x2.highLowContainer.getKeyAtIndex(pos2);
      }
    }
  }
  if (pos1 == length1) {
    highLowContainer.appendCopy(x2.highLowContainer,pos2,length2);
  }
}
Program: 90245
Project: 90245
Buggy source:
@Override public Container or(RunContainer x){
  if (isFull() || x.isFull())   return clone();
  RunContainer answer=new RunContainer(0,new short[2 * (this.nbrruns + x.nbrruns)]);
  int rlepos=0;
  int xrlepos=0;
  while ((xrlepos < x.nbrruns) && (rlepos < this.nbrruns)) {
    if (Util.compareUnsigned(getValue(rlepos),x.getValue(xrlepos)) < 0) {
      answer.smartAppend(getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
 else {
      answer.smartAppend(x.getValue(xrlepos),x.getLength(xrlepos));
      xrlepos++;
    }
  }
  while (xrlepos < x.nbrruns) {
    answer.smartAppend(x.getValue(xrlepos),x.getLength(xrlepos));
    xrlepos++;
  }
  while (rlepos < this.nbrruns) {
    answer.smartAppend(getValue(rlepos),getLength(rlepos));
    rlepos++;
  }
  return answer;
}

Fixed version (ground truth):
@Override public Container or(RunContainer x){
  if (isFull())   return clone();
  if (x.isFull())   return x.clone();
  RunContainer answer=new RunContainer(0,new short[2 * (this.nbrruns + x.nbrruns)]);
  int rlepos=0;
  int xrlepos=0;
  while ((xrlepos < x.nbrruns) && (rlepos < this.nbrruns)) {
    if (Util.compareUnsigned(getValue(rlepos),x.getValue(xrlepos)) <= 0) {
      answer.smartAppend(getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
 else {
      answer.smartAppend(x.getValue(xrlepos),x.getLength(xrlepos));
      xrlepos++;
    }
  }
  while (xrlepos < x.nbrruns) {
    answer.smartAppend(x.getValue(xrlepos),x.getLength(xrlepos));
    xrlepos++;
  }
  while (rlepos < this.nbrruns) {
    answer.smartAppend(getValue(rlepos),getLength(rlepos));
    rlepos++;
  }
  return answer;
}
Program: 90246
Project: 90246
Buggy source:
@Override public MappeableContainer or(MappeableRunContainer x){
  if (isFull() || x.isFull())   return clone();
  MappeableRunContainer answer=new MappeableRunContainer(0,ShortBuffer.allocate(2 * (this.nbrruns + x.nbrruns)));
  short[] vl=answer.valueslength.array();
  int rlepos=0;
  int xrlepos=0;
  while ((rlepos < this.nbrruns) && (xrlepos < x.nbrruns)) {
    if (BufferUtil.compareUnsigned(getValue(rlepos),x.getValue(xrlepos)) < 0) {
      answer.smartAppend(vl,getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
 else {
      answer.smartAppend(vl,x.getValue(xrlepos),x.getLength(xrlepos));
      xrlepos++;
    }
  }
  while (xrlepos < x.nbrruns) {
    answer.smartAppend(vl,x.getValue(xrlepos),x.getLength(xrlepos));
    xrlepos++;
  }
  while (rlepos < this.nbrruns) {
    answer.smartAppend(vl,getValue(rlepos),getLength(rlepos));
    rlepos++;
  }
  return answer;
}

Fixed version (ground truth):
@Override public MappeableContainer or(MappeableRunContainer x){
  if (isFull())   return clone();
  if (x.isFull())   return x.clone();
  MappeableRunContainer answer=new MappeableRunContainer(0,ShortBuffer.allocate(2 * (this.nbrruns + x.nbrruns)));
  short[] vl=answer.valueslength.array();
  int rlepos=0;
  int xrlepos=0;
  while ((rlepos < this.nbrruns) && (xrlepos < x.nbrruns)) {
    if (BufferUtil.compareUnsigned(getValue(rlepos),x.getValue(xrlepos)) <= 0) {
      answer.smartAppend(vl,getValue(rlepos),getLength(rlepos));
      rlepos++;
    }
 else {
      answer.smartAppend(vl,x.getValue(xrlepos),x.getLength(xrlepos));
      xrlepos++;
    }
  }
  while (xrlepos < x.nbrruns) {
    answer.smartAppend(vl,x.getValue(xrlepos),x.getLength(xrlepos));
    xrlepos++;
  }
  while (rlepos < this.nbrruns) {
    answer.smartAppend(vl,getValue(rlepos),getLength(rlepos));
    rlepos++;
  }
  return answer;
}
Program: 90247
Project: 90247
Buggy source:
@Benchmark public int pairwiseAnd_EWAH(BenchmarkState benchmarkState){
  int total=0;
  for (int k=0; k + 1 < benchmarkState.ewah.size(); ++k)   total+=benchmarkState.ewah.get(k).and(benchmarkState.ewah.get(k + 1)).cardinality();
  return total;
}

Fixed version (ground truth):
@Benchmark public int pairwiseAnd_EWAH(BenchmarkState benchmarkState){
  int total=0;
  for (int k=0; k + 1 < benchmarkState.ewah.size(); ++k)   total+=benchmarkState.ewah.get(k).and(benchmarkState.ewah.get(k + 1)).cardinality();
  if (total != benchmarkState.expectedvalue)   throw new RuntimeException("String_Node_Str");
  return total;
}
Program: 90248
Project: 90248
Buggy source:
@Benchmark public int pairwiseAnd_EWAH32(BenchmarkState benchmarkState){
  int total=0;
  for (int k=0; k + 1 < benchmarkState.ewah32.size(); ++k)   total+=benchmarkState.ewah32.get(k).and(benchmarkState.ewah32.get(k + 1)).cardinality();
  return total;
}

Fixed version (ground truth):
@Benchmark public int pairwiseAnd_EWAH32(BenchmarkState benchmarkState){
  int total=0;
  for (int k=0; k + 1 < benchmarkState.ewah32.size(); ++k)   total+=benchmarkState.ewah32.get(k).and(benchmarkState.ewah32.get(k + 1)).cardinality();
  if (total != benchmarkState.expectedvalue)   throw new RuntimeException("String_Node_Str");
  return total;
}
Program: 90249
Project: 90249
Buggy source:
@Benchmark public int horizontalOr_EWAH32(BenchmarkState benchmarkState){
  EWAHCompressedBitmap32 bitmapor=benchmarkState.ewah32.get(0);
  for (int j=1; j < benchmarkState.ewah32.size(); ++j) {
    bitmapor=bitmapor.or(benchmarkState.ewah32.get(j));
  }
  int answer=bitmapor.cardinality();
  return answer;
}

Fixed version (ground truth):
@Benchmark public int horizontalOr_EWAH32(BenchmarkState benchmarkState){
  EWAHCompressedBitmap32[] a=new EWAHCompressedBitmap32[benchmarkState.ewah32.size()];
  EWAHCompressedBitmap32 bitmapor=EWAHCompressedBitmap32.or(benchmarkState.ewah32.toArray(a));
  int answer=bitmapor.cardinality();
  if (answer != benchmarkState.expectedvalue)   throw new RuntimeException("String_Node_Str");
  return answer;
}
Program: 90250
Project: 90250
Buggy source:
@Benchmark public int horizontalOr_EWAH(BenchmarkState benchmarkState){
  EWAHCompressedBitmap bitmapor=benchmarkState.ewah.get(0);
  for (int j=1; j < benchmarkState.ewah.size(); ++j) {
    bitmapor=bitmapor.or(benchmarkState.ewah.get(j));
  }
  int answer=bitmapor.cardinality();
  return answer;
}

Fixed version (ground truth):
@Benchmark public int horizontalOr_EWAH(BenchmarkState benchmarkState){
  EWAHCompressedBitmap[] a=new EWAHCompressedBitmap[benchmarkState.ewah.size()];
  EWAHCompressedBitmap bitmapor=EWAHCompressedBitmap.or(benchmarkState.ewah.toArray(a));
  int answer=bitmapor.cardinality();
  if (answer != benchmarkState.expectedvalue)   throw new RuntimeException("String_Node_Str");
  return answer;
}