[前][次][番号順一覧][スレッド一覧]

ruby-changes:49438

From: shyouhei <ko1@a...>
Date: Tue, 2 Jan 2018 16:59:32 +0900 (JST)
Subject: [ruby-changes:49438] shyouhei:r61547 (trunk): long long is a C99sim

shyouhei	2018-01-02 15:41:44 +0900 (Tue, 02 Jan 2018)

  New Revision: 61547

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61547

  Log:
    long long is a C99sim
    
    Don't assume 8-bytes integers == "long long".

  Modified files:
    trunk/internal.h
Index: internal.h
===================================================================
--- internal.h	(revision 61546)
+++ internal.h	(revision 61547)
@@ -293,10 +293,15 @@ nlz_int128(uint128_t x) https://github.com/ruby/ruby/blob/trunk/internal.h#L293
 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
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]