summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-02 06:41:44 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-02 06:41:44 +0000
commitef19834ed927293738b648b15c084ca0d0f52dad (patch)
treeb7c795f290375bd5f7a7d76ca3b519dd1067bfb3 /internal.h
parentf6f1cfcbe7b15fa834de17ae014718b9e0bde3c7 (diff)
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
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h11
1 files 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
}