From 3065dd71e83565a1c21881aa5cd684d7cca16f96 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 2 Sep 2013 22:29:48 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ internal.h | 18 +++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fc09f9743..8b76a9f349 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Sep 3 07:28:49 2013 Tanaka Akira + + * 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 * vm_insnhelper.c (vm_search_super_method): use ci->argc instead of diff --git a/internal.h b/internal.h index 877611081f..37a595e111 100644 --- a/internal.h +++ b/internal.h @@ -217,19 +217,19 @@ nlz_int128(uint128_t x) #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 {