List of utility methods to do Long Bit Set
long | nextHighestPowerOfTwo(long v) returns the next highest power of two, or the current value if it's already a power of two or zero v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v |= v >> 32; v++; ... |
long | pop_andnot(long A[], long B[], int wordOffset, int numWords) Returns the popcount or cardinality of A & ~B Neither array is modified. int n = wordOffset + numWords; long tot = 0, tot8 = 0; long ones = 0, twos = 0, fours = 0; int i; for (i = wordOffset; i <= n - 8; i += 8) { long twosA, twosB, foursA, foursB, eights; long b = (A[i] & ~B[i]), c = (A[i + 1] & ~B[i + 1]); ... |
long | pop_array(long A[], int wordOffset, int numWords) Returns the number of set bits in an array of longs. int n = wordOffset + numWords; long tot = 0, tot8 = 0; long ones = 0, twos = 0, fours = 0; int i; for (i = wordOffset; i <= n - 8; i += 8) { long twosA, twosB, foursA, foursB, eights; long b = A[i], c = A[i + 1]; ... |
long | pop_intersect(long A[], long B[], int wordOffset, int numWords) Returns the popcount or cardinality of the two sets after an intersection. int n = wordOffset + numWords; long tot = 0, tot8 = 0; long ones = 0, twos = 0, fours = 0; int i; for (i = wordOffset; i <= n - 8; i += 8) { long twosA, twosB, foursA, foursB, eights; long b = (A[i] & B[i]), c = (A[i + 1] & B[i + 1]); ... |
long | pop_union(long A[], long B[], int wordOffset, int numWords) Returns the popcount or cardinality of the union of two sets. int n = wordOffset + numWords; long tot = 0, tot8 = 0; long ones = 0, twos = 0, fours = 0; int i; for (i = wordOffset; i <= n - 8; i += 8) { long twosA, twosB, foursA, foursB, eights; long b = (A[i] | B[i]), c = (A[i + 1] | B[i + 1]); ... |
long | pop_xor(long A[], long B[], int wordOffset, int numWords) poxor int n = wordOffset + numWords; long tot = 0, tot8 = 0; long ones = 0, twos = 0, fours = 0; int i; for (i = wordOffset; i <= n - 8; i += 8) { long twosA, twosB, foursA, foursB, eights; long b = (A[i] ^ B[i]), c = (A[i + 1] ^ B[i + 1]); ... |
long | swapBytes(long value) swap Bytes long b1 = (value >> 0) & 0xff; long b2 = (value >> 8) & 0xff; long b3 = (value >> 16) & 0xff; long b4 = (value >> 24) & 0xff; long b5 = (value >> 32) & 0xff; long b6 = (value >> 40) & 0xff; long b7 = (value >> 48) & 0xff; long b8 = (value >> 56) & 0xff; ... |