From 0f0121fe1a626080424f86e97159feeb9404bac7 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 30 Apr 2016 22:32:05 +0000 Subject: * 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 --- internal.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'internal.h') diff --git a/internal.h b/internal.h index a8f4240059..0bac79e012 100644 --- a/internal.h +++ b/internal.h @@ -260,6 +260,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); -- cgit v1.2.3