aboutsummaryrefslogtreecommitdiffstats
path: root/internal.h
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 22:32:05 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 22:32:05 +0000
commit12aa4f0a57619d083429d94519af45656cd243aa (patch)
treebf2bb47ce27e83ecbedec9ab753bfbe4d87e119b /internal.h
parentc33cf79b10de6e1c9efb05f541976eefc2a042b0 (diff)
downloadruby-12aa4f0a57619d083429d94519af45656cd243aa.tar.gz
* string.c (search_nonascii): use nlz on big endian environments.
* internal.h (nlz_intpr): defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal.h b/internal.h
index a8f4240059..0bac79e012 100644
--- a/internal.h
+++ b/internal.h
@@ -261,6 +261,15 @@ nlz_int128(uint128_t x)
#endif
static inline int
+nlz_intptr(uintptr_t x) {
+#if SIZEOF_VOIDP == 8
+ return nlz_long_long(x);
+#elif SIZEOF_VOIDP == 4
+ return nlz_int(x);
+#endif
+}
+
+static inline int
rb_popcount32(uint32_t x) {
x = (x & 0x55555555) + (x >> 1 & 0x55555555);
x = (x & 0x33333333) + (x >> 2 & 0x33333333);