Class BitUtil


  • public class BitUtil
    extends java.lang.Object
    Utilities for common Bit twiddling methods. Borrowed heavily from Lucene (org.apache.lucene.util.BitUtil).
    • Constructor Summary

      Constructors 
      Constructor Description
      BitUtil()  
    • Method Summary

      Modifier and Type Method Description
      static long deinterleave​(long b)
      Extract just the even-bits value as a long from the bit-interleaved value
      static long flipFlop​(long b)
      flip flops odd with even bits
      static long interleave​(int even, int odd)
      Interleaves the first 32 bits of each long value Adapted from: http://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BitUtil

        public BitUtil()
    • Method Detail

      • interleave

        public static long interleave​(int even,
                                      int odd)
        Interleaves the first 32 bits of each long value Adapted from: http://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
      • deinterleave

        public static long deinterleave​(long b)
        Extract just the even-bits value as a long from the bit-interleaved value
      • flipFlop

        public static final long flipFlop​(long b)
        flip flops odd with even bits