for (int i = 0; i < N; i++) { long x = rnd.nextLong(); if (highestOneBit(x) != reverse(lowestOneBit(reverse(x)))) thrownew RuntimeException("g: " + toHexString(x));
}
if (numberOfLeadingZeros(0) != SIZE) thrownew RuntimeException("h"); if (numberOfLeadingZeros(-1) != 0) thrownew RuntimeException("i"); if (numberOfLeadingZeros(1) != (SIZE - 1)) thrownew RuntimeException("j"); if (numberOfLeadingZeros(Long.MAX_VALUE) != 1) thrownew RuntimeException("lzmax"); if (numberOfLeadingZeros(Integer.MAX_VALUE + 1L) != (SIZE - 32)) thrownew RuntimeException("lz32");
if (numberOfTrailingZeros(0) != SIZE) thrownew RuntimeException("k"); if (numberOfTrailingZeros(1) != 0) thrownew RuntimeException("l"); if (numberOfTrailingZeros(MIN_VALUE) != (SIZE - 1)) thrownew RuntimeException("m");
for (int i = 0; i < N; i++) { long x = rnd.nextLong(); if (numberOfLeadingZeros(x) != numberOfTrailingZeros(reverse(x))) thrownew RuntimeException("n: " + toHexString(x));
} for (long i = 1, r = SIZE - 1; i != 0; i <<= 1, r--) { if (numberOfLeadingZeros(i) != (int)r ||
numberOfTrailingZeros(i) != (SIZE - (int)r - 1) ||
numberOfLeadingZeros(i) != numberOfTrailingZeros(reverse(i))) { thrownew RuntimeException("lzx: " + toHexString(i));
}
}
if (bitCount(0) != 0) thrownew RuntimeException("o");
for (int i = 0; i < SIZE; i++) { long pow2 = 1L << i; if (bitCount(pow2) != 1) thrownew RuntimeException("p: " + i); if (bitCount(pow2 -1) != i) thrownew RuntimeException("q: " + i);
}
for (int i = 0; i < N; i++) { long x = rnd.nextLong(); if (bitCount(x) != bitCount(reverse(x))) thrownew RuntimeException("r: " + toHexString(x));
}
for (int i = 0; i < N; i++) { long x = rnd.nextLong(); int dist = rnd.nextInt(); if (bitCount(x) != bitCount(rotateRight(x, dist))) thrownew RuntimeException("s: " + toHexString(x) +
toHexString(dist)); if (bitCount(x) != bitCount(rotateLeft(x, dist))) thrownew RuntimeException("t: " + toHexString(x) +
toHexString(dist)); if (rotateRight(x, dist) != rotateLeft(x, -dist)) thrownew RuntimeException("u: " + toHexString(x) +
toHexString(dist)); if (rotateRight(x, -dist) != rotateLeft(x, dist)) thrownew RuntimeException("v: " + toHexString(x) +
toHexString(dist));
}
for (int i = 0; i < N; i++) { long x = rnd.nextLong(); if (bitCount(x) != bitCount(reverseBytes(x))) thrownew RuntimeException("z: " + toHexString(x));
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.