summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-14 14:28:33 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-14 14:28:33 +0000
commit240f3056aa0e095a6b03d5763c2775e97b4ee7d3 (patch)
tree071e9f61ebc458a88ecc09f9ce0deb3940929a0c /bignum.c
parentb0eacd027a5f45c0135c7fa294bacb8162ae46b9 (diff)
* configure.in: Check __builtin_popcountl, __builtin_bswap32 and
__builtin_bswap64. * internal.h (swap32): Use the configure result for the condition to use __builtin_bswap32. (swap64): Use the configure result for the condition to use __builtin_bswap64. * bignum.c (ones): Use the configure result for the condition to use __builtin_popcountl. (bary_unpack_internal): Use appropriate types for swap argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bignum.c b/bignum.c
index dfe5e99c0d..ec99f7be6e 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1137,19 +1137,19 @@ bary_unpack_internal(BDIGIT *bdigits, size_t num_bdigits, const void *words, siz
}
#if defined(HAVE_UINT16_T) && 2 <= SIZEOF_BDIGITS
if (wordsize == 2 && (uintptr_t)words % ALIGNOF(uint16_t) == 0) {
- BDIGIT u = *(uint16_t *)buf;
+ uint16_t u = *(uint16_t *)buf;
return integer_unpack_single_bdigit(need_swap ? swap16(u) : u, sizeof(uint16_t), flags, dp);
}
#endif
#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGITS
if (wordsize == 4 && (uintptr_t)words % ALIGNOF(uint32_t) == 0) {
- BDIGIT u = *(uint32_t *)buf;
+ uint32_t u = *(uint32_t *)buf;
return integer_unpack_single_bdigit(need_swap ? swap32(u) : u, sizeof(uint32_t), flags, dp);
}
#endif
#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGITS
if (wordsize == 8 && (uintptr_t)words % ALIGNOF(uint64_t) == 0) {
- BDIGIT u = *(uint64_t *)buf;
+ uint64_t u = *(uint64_t *)buf;
return integer_unpack_single_bdigit(need_swap ? swap64(u) : u, sizeof(uint64_t), flags, dp);
}
#endif
@@ -3307,7 +3307,7 @@ big_rshift(VALUE x, unsigned long shift)
static inline int
ones(register unsigned long x)
{
-#if GCC_VERSION_SINCE(3, 4, 0)
+#ifdef HAVE_BUILTIN___BUILTIN_POPCOUNTL
return __builtin_popcountl(x);
#else
# if SIZEOF_LONG == 8