Android Utililty Methods Long Bit Shift

List of utility methods to do Long Bit Shift

Description

The list of methods to do Long Bit Shift are organized into topic(s).

Method

booleanisPowerOfTwo(long n)
Returns true if the argument is a power of two.
return (n > 0) && ((n & (n - 1)) == 0);
longflip32(long num)
for switching big/small endian
long tmp = num;
tmp = ((tmp & 0x000000FF) << 24) + ((tmp & 0x0000FF00) << 8)
        + ((tmp & 0x00FF0000) >> 8) + ((tmp & 0xFF000000) >> 24);
return tmp;
longswap(long x)
swap
return (long) (((long) swap((int) (x)) << 32) | ((long) swap((int) (x >> 32)) & 0xffffffffL));
booleanisPowerOfTwo(long v)
returns true if v is a power of two or zero
return ((v & (v - 1)) == 0);