Tabnine Logo
BitVector.bitIndex
Code IndexAdd Tabnine to your IDE (free)

How to use
bitIndex
method
in
com.artemis.utils.BitVector

Best Java code snippets using com.artemis.utils.BitVector.bitIndex (Showing top 5 results out of 315)

origin: junkdog/artemis-odb

public int size() {
  // the number of bytes that can fit without using "more" memory
  return bitIndex(array.length());
}
origin: junkdog/artemis-odb

public int nextClearBit(int fromIndex) {
  checkIndex(fromIndex);
  int index = wordIndex(fromIndex);
  // special case for first index
  int fromBit = fromIndex - (bitIndex(index));
  int word = getWord(array, index);
  for (int i = fromBit; i < 32; i++) {
    if ((word & (1 << i)) == 0) {
      return (bitIndex(index)) + i;
    }
  }
  // loop through the rest
  while (true) {
    index++;
    word = getWord(array, index);
    if (word != 0xffffffff) {
      return (bitIndex(index)) + Integer.numberOfTrailingZeros(~word);
    }
  }
}
origin: junkdog/artemis-odb

public int length() {
  int last = trimToSize(array);
  if (last == -1) {
    return 0;
  }
  // compute the position of the leftmost bit's index
  int offsets[] = { 16, 8, 4, 2, 1 };
  int bitMasks[] = { 0xffff0000, 0xff00, 0xf0, 0xc, 0x2 };
  int position = bitIndex(last) + 1;
  int word = getWord(array, last);
  for (int i = 0; i < offsets.length; i++) {
    if ((word & bitMasks[i]) != 0) {
      word >>>= offsets[i];
      position += offsets[i];
    }
  }
  return position;
}
origin: junkdog/artemis-odb

public int nextSetBit(int fromIndex) {
  checkIndex(fromIndex);
  int index = wordIndex(fromIndex);
  // check the current word
  int word = getWord(array, index);
  if (word != 0) {
    for (int i = bitOffset(fromIndex); i < 32; i++) {
      if ((word & (1 << i)) != 0) {
        return (bitIndex(index)) + i;
      }
    }
  }
  index++;
  // find the next set word
  trimToSize(array);
  index = nextSetWord(array, index);
  if (index == -1) {
    return -1;
  }
  // return the next set bit
  return (bitIndex(index))
      + Integer.numberOfTrailingZeros(array.get(index));
};
origin: junkdog/artemis-odb

if ((bitIndex(newLength)) - fromIndex != 0) {
  maskOutWord(array, newLength - 1, bitOffset(fromIndex), 32);
com.artemis.utilsBitVectorbitIndex

Popular methods of BitVector

  • get
  • clear
  • nextSetBit
    Returns the index of the first bit that is set to true that occurs on or after the specified startin
  • set
  • <init>
  • cardinality
  • equals
  • intersects
    Returns true if the specified BitVector has any bits set to true that are also set to true in this B
  • isEmpty
  • length
    Returns the "logical size" of this bitset: the index of the highest set bit in the bitset plus one.
  • or
    Performs a logical OR of this bit set with the bit set argument. This bit set is modified so that a
  • toIntBag
    Decodes the set bits as integers. The destination IntBag is reset before the bits are transposed.
  • or,
  • toIntBag,
  • unsafeGet,
  • andNot,
  • bitOffset,
  • checkCapacity,
  • checkIndex,
  • checkRange,
  • clone

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • getContentResolver (Context)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JTable (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Option (scala)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now