[前][次][番号順一覧][スレッド一覧]

ruby-changes:31752

From: glass <ko1@a...>
Date: Mon, 25 Nov 2013 01:03:31 +0900 (JST)
Subject: [ruby-changes:31752] glass:r43831 (trunk): * internal.h: use __builtin_bswap16() if possible.

glass	2013-11-25 01:03:22 +0900 (Mon, 25 Nov 2013)

  New Revision: 43831

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43831

  Log:
    * internal.h: use __builtin_bswap16() if possible.
    
    * configure.in: check existence of __builtin_bswap16().

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/internal.h
Index: configure.in
===================================================================
--- configure.in	(revision 43830)
+++ configure.in	(revision 43831)
@@ -1916,6 +1916,7 @@ AC_CACHE_CHECK([for $1], AS_TR_SH(rb_cv_ https://github.com/ruby/ruby/blob/trunk/configure.in#L1916
 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)])
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43830)
+++ ChangeLog	(revision 43831)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Nov 25 00:50:03 2013  Masaki Matsushita  <glass.saga@g...>
+
+	* internal.h: use __builtin_bswap16() if possible.
+
+	* configure.in: check existence of __builtin_bswap16().
+
 Sun Nov 24 22:24:19 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (bigxor_int): Apply BIGLO for long in a BDIGIT expression.
Index: internal.h
===================================================================
--- internal.h	(revision 43830)
+++ internal.h	(revision 43831)
@@ -70,6 +70,12 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/internal.h#L70
 #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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]