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

ruby-changes:30705

From: akr <ko1@a...>
Date: Tue, 3 Sep 2013 07:29:58 +0900 (JST)
Subject: [ruby-changes:30705] akr:r42784 (trunk): * internal.h (bit_length): Add casts to fix complation error with

akr	2013-09-03 07:29:48 +0900 (Tue, 03 Sep 2013)

  New Revision: 42784

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42784

  Log:
    * internal.h (bit_length): Add casts to fix complation error with
      clang 3.0 -Werror,-Wshorten-64-to-32.
      [ruby-dev:47687] reported by SASADA Koichi.

  Modified files:
    trunk/ChangeLog
    trunk/internal.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42783)
+++ ChangeLog	(revision 42784)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Sep  3 07:28:49 2013  Tanaka Akira  <akr@f...>
+
+	* internal.h (bit_length): Add casts to fix complation error with
+	  clang 3.0 -Werror,-Wshorten-64-to-32.
+	  [ruby-dev:47687] reported by SASADA Koichi.
+
 Tue Sep  3 03:17:26 2013  Koichi Sasada  <ko1@a...>
 
 	* vm_insnhelper.c (vm_search_super_method): use ci->argc instead of
Index: internal.h
===================================================================
--- internal.h	(revision 42783)
+++ internal.h	(revision 42784)
@@ -217,19 +217,19 @@ nlz_int128(uint128_t x) https://github.com/ruby/ruby/blob/trunk/internal.h#L217
 
 #if defined(HAVE_UINT128_T)
 #   define bit_length(x) \
-        (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int(x) : \
-         sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long(x) : \
-         sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long(x) : \
-         SIZEOF_INT128_T * CHAR_BIT - nlz_int128(x))
+        (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)x) : \
+         sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)x) : \
+         sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)x) : \
+         SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)x))
 #elif defined(HAVE_LONG_LONG)
 #   define bit_length(x) \
-        (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int(x) : \
-         sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long(x) : \
-         SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long(x))
+        (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)x) : \
+         sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)x) : \
+         SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)x))
 #else
 #   define bit_length(x) \
-        (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int(x) : \
-         SIZEOF_LONG * CHAR_BIT - nlz_long(x))
+        (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)x) : \
+         SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)x))
 #endif
 
 struct rb_deprecated_classext_struct {

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

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