mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* internal.h: use __builtin_bswap16() if possible.
* configure.in: check existence of __builtin_bswap16(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bc65d709ab
commit
b25a6494cc
3 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Nov 25 00:50:03 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* internal.h: use __builtin_bswap16() if possible.
|
||||
|
||||
* configure.in: check existence of __builtin_bswap16().
|
||||
|
||||
Sun Nov 24 22:24:19 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (bigxor_int): Apply BIGLO for long in a BDIGIT expression.
|
||||
|
|
|
@ -1916,6 +1916,7 @@ AC_CACHE_CHECK([for $1], AS_TR_SH(rb_cv_builtin_$1),
|
|||
if test "${AS_TR_SH(rb_cv_builtin_$1)}" != no; then
|
||||
AC_DEFINE(AS_TR_CPP(HAVE_BUILTIN_$1))
|
||||
fi])
|
||||
RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap16, [__builtin_bswap16(0)])
|
||||
RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap32, [__builtin_bswap32(0)])
|
||||
RUBY_CHECK_BUILTIN_FUNC(__builtin_bswap64, [__builtin_bswap64(0)])
|
||||
RUBY_CHECK_BUILTIN_FUNC(__builtin_clz, [__builtin_clz(0)])
|
||||
|
|
|
@ -69,6 +69,12 @@ extern "C" {
|
|||
#define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
||||
#define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
|
||||
|
||||
#ifndef swap16
|
||||
# ifdef HAVE_BUILTIN___BUILTIN_BSWAP16
|
||||
# define swap16(x) __builtin_bswap16(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef swap16
|
||||
# define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF)))
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue