From f95b77b61a3e46a70426b2b5787fbdb84d5d84b3 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 27 May 2018 20:15:03 -0700 Subject: [PATCH] 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. --- common/bitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/bitmap.cpp b/common/bitmap.cpp index 50ba225f81..d86d537e43 100644 --- a/common/bitmap.cpp +++ b/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