summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-20 13:52:06 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-20 13:52:06 +0000
commitc0848eeda4bd60d9f8915993e31f6fa027f28c88 (patch)
treeba8be0ebf207c64403bf499fec2b82cdc0ccc45e /hash.c
parent01fcd07bff931564b584559c456c90fdf79bf125 (diff)
merge revision(s) 61471,61472: [Backport #14231]
Use UINT128_T support flag from configure Current check for __uint128_t in hash.c is not valid, since it ignores compilers other than gcc. We hit this on lcc on e2k platform. Configure script properly checks from 128-bit data types support and sets HAVE_UINT128_T accordingly. This approach is already used within ruby at bignum.c, random.c, etc. Probably hash.c is an overlooked remnant of old days. This patch fixes this. [ruby-core:84438] [Bug #14231] [Fix GH-1781] From: Andrew Savchenko <bircoph@altlinux.org> hash.c: use uint128_t * hash.c (mult_and_mix): use uint128_t instead of __uint128_t. [ruby-core:84438] [Bug #14231] From: Nobuyoshi Nakada <nobu@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index e8c459067b..c372686f12 100644
--- a/hash.c
+++ b/hash.c
@@ -235,8 +235,8 @@ static const uint64_t prime2 = ((uint64_t)0xcdb32970 << 32) | 0x830fcaa1;
static inline uint64_t
mult_and_mix(uint64_t m1, uint64_t m2)
{
-#if defined(__GNUC__) && UINT_MAX != ULONG_MAX
- __uint128_t r = (__uint128_t) m1 * (__uint128_t) m2;
+#if defined HAVE_UINT128_T
+ uint128_t r = (uint128_t) m1 * (uint128_t) m2;
return (uint64_t) (r >> 64) ^ (uint64_t) r;
#else
uint64_t hm1 = m1 >> 32, hm2 = m2 >> 32;