Returns the index of the last set bit before or on the index specified.
-1 is returned if there are no more set bits.
978943
long prevSetBit(long index) {
		assert index >= 0 && index < numBits : "index=" + index + " numBits=" + numBits;
		int i = (int) (index >> 6);
		final int subIndex = (int) (index & 0x3f); // index within the word
		long word = (bits[i] << (63 - subIndex)); // skip all the bits to the
													// left of index

		if (word != 0) {
			return (i << 6) + subIndex - Long.numberOfLeadingZeros(word); // See
																			// LUCENE-3197
		}

		while (--i >= 0) {
			word = bits[i];
			if (word != 0) {
				return (i << 6) + 63 - Long.numberOfLeadingZeros(word);
			}
		}

		return -1;
	}
1238320
int set(int bitIndex, boolean value) {
        int wordIndex = wordIndex(bitIndex);
        long bitMask = 1L << bitIndex;
        int previous = (words[wordIndex] & bitMask) != 0 ? 1 : 0;
        if (value) {
            words[wordIndex] |= bitMask;
        } else {
            words[wordIndex] &= ~bitMask;
        }
        return previous;
    }
475020
boolean get(int bitIndex) {
        int wordIndex = wordIndex(bitIndex);
        long bitMask = 1L << bitIndex;
        return (words[wordIndex] & bitMask) != 0;
    }
806882
public int getAnalysisBits()
  {
    int bits = 0;
    
    if (m_exprs != null)
    {
      int n = m_exprs.length;

      for (int i = 0; i < n; i++)
      {
      	int bit = m_exprs[i].getAnalysisBits();
        bits |= bit;
      }
    }

    return bits;
  }
1213893
def find_previous(element, l):
    
    length = len(l)
    for index, current in enumerate(l):
        # current is the last element
        if length - 1 == index:
            return current

        # current is the first element
        if index == 0:
            if element < current:
                return None

        if current <= element < l[index+1]:
            return current
776981
public int get(int index) {
        if (d_bitsPerElem == 0)
            return 0;

        int startIdx = (index * d_bitsPerElem) / INT_SIZE;
        int startBit = (index * d_bitsPerElem) % INT_SIZE;

        int result = (d_data[startIdx] >>> startBit) & MASK[d_bitsPerElem];

        if ((startBit + d_bitsPerElem) > INT_SIZE) {
            int done = INT_SIZE - startBit;
            result |= (d_data[startIdx + 1] & MASK[d_bitsPerElem - done]) << done;
        }

        return result;
    }
918470
def setbit(self, key, offset, value):
        
        key = self._encode(key)
        index, bits, mask = self._get_bits_and_offset(key, offset)

        if index >= len(bits):
            bits.extend(b"\x00" * (index + 1 - len(bits)))

        prev_val = 1 if (bits[index] & mask) else 0

        if value:
            bits[index] |= mask
        else:
            bits[index] &= ~mask

        self.redis[key] = bytes(bits)

        return prev_val
209968
private static int lastIndexOf(Object o, Object[] elements, int index) {
        if (o == null) {
            for (int i = index; i >= 0; i--)
                if (elements[i] == null)
                    return i;
        } else {
            for (int i = index; i >= 0; i--)
                if (o.equals(elements[i]))
                    return i;
        }
        return -1;
    }
579478
protected int getLastNumPos(final String s) {
        int i = 0;
        for ( ; i < s.length(); i++) {
            if (NUM_CHARS.indexOf(s.charAt(i)) < 0) {
                break;
            }
        }
        return i - 1;
    }
542463
public long index() {
    return Long.valueOf(file.getName().substring(file.getName().lastIndexOf(PART_SEPARATOR, file.getName().lastIndexOf(PART_SEPARATOR) - 1) + 1, file.getName().lastIndexOf(PART_SEPARATOR)));
  }
55591
public static int previousSetBit(long[] v, int start) {
    if(start < 0) {
      return -1;
    }
    int wordindex = start >>> LONG_LOG2_SIZE;
    if(wordindex >= v.length) {
      return magnitude(v) - 1;
    }
    // Initial word
    final int off = 63 - (start & LONG_LOG2_MASK);
    long cur = v[wordindex] & (LONG_ALL_BITS >>> off);
    for(;;) {
      if(cur != 0) {
        return wordindex * Long.SIZE + 63 - ((cur == LONG_ALL_BITS) ? 0 : Long.numberOfLeadingZeros(cur));
      }
      if(wordindex == 0) {
        return -1;
      }
      cur = v[--wordindex];
    }
  }
998880
public int getEvictionIndex() {
    /*
     * If the table has been shrunk then it's possible for the clock-hand to
     * point past the end of the table.  We cannot allow the initial-hand to
     * be equal to this otherwise we may never be able to terminate this loop.
     */
    if (clockHand >= hashtable.capacity()) {
      clockHand = 0;
    }

    int initialHand = clockHand;
    int loops = 0;
    while (true) {
      if ((clockHand += ENTRY_SIZE) + STATUS >= hashtable.capacity()) {
        clockHand = 0;
      }

      int hand = hashtable.get(clockHand + STATUS);

      if (evictable(hand) && ((hand & PRESENT_CLOCK) == 0)) {
        return clockHand;
      } else if ((hand & PRESENT_CLOCK) == PRESENT_CLOCK) {
        hashtable.put(clockHand + STATUS, hand & ~PRESENT_CLOCK);
      }

      if (initialHand == clockHand && ++loops == 2) {
        return -1;
      }
    }
  }
670557
protected final int findOffset(int idx) {
    if(idx >= _len)throw new IndexOutOfBoundsException();
    int sparseLen = sparseLen();
    if(sparseLen == 0)return 0;
    final byte [] mem = _mem;
    if(idx <= getId(OFF))  // easy cut off accessing the zeros prior first nz
      return OFF;
    int last = mem.length - _ridsz - _valsz;
    if(idx >= getId(last))  // easy cut off accessing of the tail zeros
      return last;
    final int off = _lastOff;
    int lastIdx = getId(off);
    // check the last accessed elem + one after
    if( idx == lastIdx ) return off;
    if(idx > lastIdx){
      // check the next one (no need to check bounds, already checked at the beginning)
      final int nextOff = off + _ridsz + _valsz;
      int nextId =  getId(nextOff);
      if(idx < nextId) return off;
      if(idx == nextId){
        _lastOff = nextOff;
        return nextOff;
      }
    }
    // binary search
    int lo=0, hi = sparseLen;
    while( lo+1 != hi ) {
      int mid = (hi+lo)>>>1;
      if( idx < getId(getOff(mid))) hi = mid;
      else          lo = mid;
    }
    int y =  getOff(lo);
    _lastOff = y;
    return y;
  }
866154
@Pure
	public int lastIndexOf(RoadSegment segment) {
		int count = 0;
		int index;
		int lastIndex = -1;
		for (final RoadPath p : this.paths) {
			index = p.lastIndexOf(segment);
			if (index >= 0) {
				lastIndex = count + index;
			}
			count += p.size();
		}
		return lastIndex;
	}
343970
private int startIndex(Date start) {
        int lastIndex = ranges.size();

        for (int i = 0; i < ranges.size(); i++) {
            Range r = ranges.get(i);
            if (start.before(r.start)) {
                break;
            }
            lastIndex = i;
        }
        return lastIndex;
    }
1083410
@Override
	public int lastIndexOf(long elem) {
		// Find the location to insert the object at
		int pos=binarySearch(elem);

		// Not found
		if(pos<0) return -1;

		// Found one, iterate forwards to the last one
		while(pos<(size-1) && elementData[pos+1]==elem) pos++;
		return pos;
	}
609521
private final int getLowestSetBit() {
        if (intLen == 0)
            return -1;
        int j, b;
        for (j=intLen-1; (j > 0) && (value[j+offset] == 0); j--)
            ;
        b = value[j+offset];
        if (b == 0)
            return -1;
        return ((intLen-1-j)<<5) + Integer.numberOfTrailingZeros(b);
    }