From ef19834ed927293738b648b15c084ca0d0f52dad Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 2 Jan 2018 06:41:44 +0000 Subject: [PATCH] long long is a C99sim Don't assume 8-bytes integers == "long long". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- internal.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal.h b/internal.h index b2ef2d5258..4b4dace768 100644 --- a/internal.h +++ b/internal.h @@ -293,10 +293,15 @@ nlz_int128(uint128_t x) static inline unsigned int nlz_intptr(uintptr_t x) { -#if SIZEOF_VOIDP == 8 - return nlz_long_long(x); -#elif SIZEOF_VOIDP == 4 +#if SIZEOF_UINTPTR_T == SIZEOF_INT return nlz_int(x); +#elif SIZEOF_UINTPTR_T == SIZEOF_LONG + return nlz_long(x); +#elif SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG + return nlz_long_long(x); +#else + #error no known integer type corresponds uintptr_t + return /* sane compiler */ ~0; #endif }