void storeHash(uint hash)
{
- int bits = bit_cast(hash);
- hashBits.setBit((bits & 0xFFFF) % NumBits);
- hashBits.setBit((bits >> 16) % NumBits);
+ hashBits.setBit((hash & 0xFFFF) % NumBits); // NOLINT it's uint all the way and the modulo puts us back in the 0..1023 range
+ hashBits.setBit((hash >> 16) % NumBits); // NOLINT
}
bool isHashMaybeStored(uint hash) const
{
- int bits = bit_cast(hash);
- return hashBits.testBit((bits & 0xFFFF) % NumBits)
- && hashBits.testBit((bits >> 16) % NumBits);
+ return hashBits.testBit((hash & 0xFFFF) % NumBits) // NOLINT
+ && hashBits.testBit((hash >> 16) % NumBits); // NOLINT
}
private:
- static int bit_cast(uint input)
- {
- int output = 0;
- std::memcpy(&output, &input, sizeof(int));
- return output;
- }
-
QBitArray hashBits;
};