BITCOUNT(X'ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00') returns 120 rather than the expected value of 64. It appears to be double counting the 2nd-to-8th bytes, and ignoring the 10th-to-16th bytes.
Removing the last 00 will stop this behaviour and cause it to return 64. Adding another 8 zero bytes will cause it to triple-count many of the ff bytes.
I think I know why. In BitFunction.bitCount(), I believe the line reading c += Long.bitCount(Bits.readLong(bytes, i)); should actually be c += Long.bitCount(Bits.readLong(bytes, i << 3));.