Browse Source

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.
pull/17/head
Seth Hillbrand 8 years ago
parent
commit
f95b77b61a
  1. 2
      common/bitmap.cpp

2
common/bitmap.cpp

@ -61,7 +61,7 @@ namespace std {
{
static const bool sz64 = sizeof( uintptr_t ) == 8;
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
// only makes things slower, not broken. BITMAP_DEF is a pointer, so the most

Loading…
Cancel
Save