diff options
author | Brian Sullivan <briansul@microsoft.com> | 2017-10-20 11:36:42 -0700 |
---|---|---|
committer | Brian Sullivan <briansul@microsoft.com> | 2017-10-20 11:36:42 -0700 |
commit | fb789966c8ef538001f2f6c90bc156637e863d74 (patch) | |
tree | 15422fb235bddf117aff3cd9f903932ab2f22ed4 /src/jit/compiler.hpp | |
parent | ae991c3a6042256c25d6c82e2714cd41eb14798a (diff) | |
download | coreclr-fb789966c8ef538001f2f6c90bc156637e863d74.tar.gz coreclr-fb789966c8ef538001f2f6c90bc156637e863d74.tar.bz2 coreclr-fb789966c8ef538001f2f6c90bc156637e863d74.zip |
Fix the gtHashValue to properly hash all the bits when we have a 64-bit item
Diffstat (limited to 'src/jit/compiler.hpp')
-rw-r--r-- | src/jit/compiler.hpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp index 9743173f5a..acc7bb688e 100644 --- a/src/jit/compiler.hpp +++ b/src/jit/compiler.hpp @@ -175,12 +175,25 @@ inline BOOL genMaxOneBit(unsigned value) * Given a value that has exactly one bit set, return the position of that * bit, in other words return the logarithm in base 2 of the given value. */ - inline unsigned genLog2(unsigned value) { return BitPosition(value); } +// Given an unsigned 64-bit value, returns the lower 32-bits in unsigned format +// +inline unsigned ulo32(unsigned __int64 value) +{ + return static_cast<unsigned>(value); +} + +// Given an unsigned 64-bit value, returns the upper 32-bits in unsigned format +// +inline unsigned uhi32(unsigned __int64 value) +{ + return static_cast<unsigned>(value >> 32); +} + /***************************************************************************** * * Given a value that has exactly one bit set, return the position of that @@ -189,8 +202,8 @@ inline unsigned genLog2(unsigned value) inline unsigned genLog2(unsigned __int64 value) { - unsigned lo32 = (unsigned)value; - unsigned hi32 = (unsigned)(value >> 32); + unsigned lo32 = ulo32(value); + unsigned hi32 = uhi32(value); if (lo32 != 0) { |