Codota Logo
BitVector.bitOffset
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: junkdog/artemis-odb

private static boolean get(JsArrayInteger array, int bitIndex) {
  // retrieve the bits for the given index
  int word = getWord(array, wordIndex(bitIndex));
  // shift and mask the bit out
  return ((word >>> (bitOffset(bitIndex))) & 1) == 1;
}
origin: junkdog/artemis-odb

private static void set(JsArrayInteger array, int bitIndex) {
  int index = wordIndex(bitIndex);
  array.set(index, getWord(array, index) | (1 << (bitOffset(bitIndex))));
}
origin: junkdog/artemis-odb

private static void clear(JsArrayInteger array, int bitIndex) {
  int index = wordIndex(bitIndex);
  int word = getWord(array, index);
  if (word != 0) {
    // mask the correct bit out
    setWord(array, index, word & ~(1 << (bitOffset(bitIndex))));
  }
}
origin: junkdog/artemis-odb

private static void flip(JsArrayInteger array, int bitIndex) {
  // calculate index and offset
  int index = wordIndex(bitIndex);
  int offset = bitOffset(bitIndex);
  // figure out if the bit is on or off
  int word = getWord(array, index);
  if (((word >>> offset) & 1) == 1) {
    // if on, turn it off
    setWord(array, index, word & ~(1 << offset));
  } else {
    // if off, turn it on
    array.set(index, word | (1 << offset));
  }
};
origin: junkdog/artemis-odb

private static void set(JsArrayInteger array, int fromIndex, int toIndex) {
  int first = wordIndex(fromIndex);
  int last = wordIndex(toIndex);
  int startBit = bitOffset(fromIndex);
  int endBit = bitOffset(toIndex);
  if (first == last) {
    // set the bits in between first and last
    maskInWord(array, first, startBit, endBit);
  } else {
    // set the bits from fromIndex to the next 32 bit boundary
    if (startBit != 0) {
      maskInWord(array, first++, startBit, 32);
    }
    // set the bits from the last 32 bit boundary to the toIndex
    if (endBit != 0) {
      maskInWord(array, last, 0, endBit);
    }
    //
    // set everything in between
    //
    for (int i = first; i < last; i++) {
      array.set(i, 0xffffffff);
    }
  }
}
origin: junkdog/artemis-odb

  maskOutWord(array, newLength - 1, bitOffset(fromIndex), 32);
int first = wordIndex(fromIndex);
int last = wordIndex(toIndex);
int startBit = bitOffset(fromIndex);
int endBit = bitOffset(toIndex);
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

int startBit = bitOffset(fromIndex);
int end = bitOffset(toIndex);
origin: junkdog/artemis-odb

int rightShift = bitOffset(fromIndex);
  int subTo = wordIndex(toIndex + 31);
  JsArrayInteger subSet = slice(array, subFrom, subTo);
  int leftOvers = bitOffset(toIndex);
  if (leftOvers != 0) {
    maskOutWord(subSet, subTo - subFrom - 1, leftOvers, 32);
  int end = 32 - (bitOffset(toIndex));
  int end = 32 - (bitOffset(toIndex));
  current = (current << (rightShift + end)) >>> (rightShift + end);
  if (current != 0) {
com.artemis.utilsBitVectorbitOffset

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,
  • bitIndex,
  • checkCapacity,
  • checkIndex,
  • checkRange,
  • clone

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getExternalFilesDir (Context)
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • BoxLayout (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now