src/java/org/apache/cassandra/utils/obs/OpenBitSet.java
/**
   * Clears a range of bits.  Clearing past the end does not change the size of the set.
   *
   * @param startIndex lower index
   * @param endIndex one-past the last bit to clear
   */
Clears a range of bits.  Clearing past the end does not change the size of the set.
@param startIndex lower index
@param endIndex one-past the last bit to clear
Clears a range of bits . Clearing past the end does not change the size of the set . @param startIndex lower index @param endIndex one - past the last bit to clear
public void clear(int startIndex, int endIndex) {
    if (endIndex <= startIndex) return;
    int startWord = (startIndex>>6);
    if (startWord >= wlen) return;
    int endWord   = ((endIndex-1)>>6);
    long startmask = -1L << startIndex;
    long endmask = -1L >>> -endIndex;  
    startmask = ~startmask;
    endmask = ~endmask;
    if (startWord == endWord) {
      bits[startWord / PAGE_SIZE][startWord % PAGE_SIZE] &= (startmask | endmask);
      return;
    }
    bits[startWord / PAGE_SIZE][startWord % PAGE_SIZE]  &= startmask;
    int middle = Math.min(wlen, endWord);
    if (startWord / PAGE_SIZE == middle / PAGE_SIZE)
    {
        Arrays.fill(bits[startWord/PAGE_SIZE], (startWord+1) % PAGE_SIZE, middle % PAGE_SIZE, 0L);
    } else
    {
        while (++startWord<middle)
            bits[startWord / PAGE_SIZE][startWord % PAGE_SIZE] = 0L;
    }
    if (endWord < wlen) {
      bits[endWord / PAGE_SIZE][endWord % PAGE_SIZE] &= endmask;
    }
  }
public void clear ( int startIndex , int endIndex ) { if ( endIndex <= startIndex ) return ; int startWord = ( startIndex >> 6 ) ; if ( startWord >= wlen ) return ; int endWord = ( ( endIndex - 1 ) >> 6 ) ; long startmask = - 1L << startIndex ; long endmask = - 1L >>> - endIndex ; startmask = ~ startmask ; endmask = ~ endmask ; if ( startWord == endWord ) { bits [ startWord / PAGE_SIZE ] [ startWord % PAGE_SIZE ] &= ( startmask | endmask ) ; return ; } bits [ startWord / PAGE_SIZE ] [ startWord % PAGE_SIZE ] &= startmask ; int middle = Math . min ( wlen , endWord ) ; if ( startWord / PAGE_SIZE == middle / PAGE_SIZE ) { Arrays . fill ( bits [ startWord / PAGE_SIZE ] , ( startWord + 1 ) % PAGE_SIZE , middle % PAGE_SIZE , 0L ) ; } else { while ( ++ startWord < middle ) bits [ startWord / PAGE_SIZE ] [ startWord % PAGE_SIZE ] = 0L ; } if ( endWord < wlen ) { bits [ endWord / PAGE_SIZE ] [ endWord % PAGE_SIZE ] &= endmask ; } }
Clears a range of bits.
Clears a range of bits .
// since endIndex is one past the end, this is index of the last // word to be changed. // 64-(endIndex&0x3f) is the same as -endIndex due to wrap // invert masks since we are clearing