Fix overflow on 32-bit machine

Bitmap hash incorrectly shifted by 60 bits on 32 bit machines while only
shifting 28 bits on 64 bit machines.
This commit is contained in:
Seth Hillbrand 2018-05-27 20:15:03 -07:00
parent ee34aab07a
commit f95b77b61a
1 changed files with 1 additions and 1 deletions

View File

@ -61,7 +61,7 @@ namespace std {
{ {
static const bool sz64 = sizeof( uintptr_t ) == 8; static const bool sz64 = sizeof( uintptr_t ) == 8;
static const size_t mask = sz64 ? 0xF000000000000000uLL : 0xF0000000uL; static const size_t mask = sz64 ? 0xF000000000000000uLL : 0xF0000000uL;
static const size_t offset = sz64 ? 28 : 60; static const size_t offset = sz64 ? 60 : 28;
// The hash only needs to be fast and simple, not necessarily accurate - a collision // The hash only needs to be fast and simple, not necessarily accurate - a collision
// only makes things slower, not broken. BITMAP_DEF is a pointer, so the most // only makes things slower, not broken. BITMAP_DEF is a pointer, so the most