BitUtil
A variety of high efficiency bit twiddling routines and encoders for primitives.
Types
A VarHandle to read/write big endian short from a byte array. Shape: short vh.get(byte[] arr, int ofs) and void vh.set(byte[] arr, int ofs, short val)
A VarHandle to read/write little endian long from a byte array. Shape: long vh.get(byte[] arr, int ofs) and void vh.set(byte[] arr, int ofs, long val)
A VarHandle to read/write little endian short from/to a byte array. Shape: short vh.get(byte[] arr, int ofs) and void vh.set(byte[] arr, int ofs, short val)
A VarHandle to read/write native endian int from a byte array. Shape: int vh.get(byte[] arr, int ofs) and void vh.set(byte[] arr, int ofs, int val)
Functions
Extract just the even-bits value as a long from the bit-interleaved value
Interleaves the first 32 bits of each long value
Return true if, and only if, the provided integer - treated as an unsigned integer - is either 0 or a power of two.
returns the next highest power of two, or the current value if it's already a power of two or zero
Decode an int previously encoded with .zigZagEncode.
Decode a long previously encoded with .zigZagEncode.
Same as .zigZagEncode but on integers.
Zig-zag encode the provided long. Assuming the input is a signed long whose absolute value can be stored on n bits, the returned value will be an unsigned long that can be stored on n+1 bits.