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

ruby-changes:34831

From: nobu <ko1@a...>
Date: Wed, 23 Jul 2014 23:50:09 +0900 (JST)
Subject: [ruby-changes:34831] nobu:r46914 (trunk): defines.h: PACKED_STRUCT_UNALIGNED

nobu	2014-07-23 23:50:02 +0900 (Wed, 23 Jul 2014)

  New Revision: 46914

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

  Log:
    defines.h: PACKED_STRUCT_UNALIGNED
    
    * include/ruby/defines.h (PACKED_STRUCT_UNALIGNED): move from
      configure.in for universal binary.

  Modified files:
    trunk/configure.in
    trunk/include/ruby/defines.h
Index: include/ruby/defines.h
===================================================================
--- include/ruby/defines.h	(revision 46913)
+++ include/ruby/defines.h	(revision 46914)
@@ -261,6 +261,26 @@ void rb_ia64_flushrs(void); https://github.com/ruby/ruby/blob/trunk/include/ruby/defines.h#L261
     RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
 #endif
 
+#ifndef UNALIGNED_WORD_ACCESS
+# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
+     defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
+     defined(__mc68020__)
+#   define UNALIGNED_WORD_ACCESS 1
+# else
+#   define UNALIGNED_WORD_ACCESS 0
+# endif
+#endif
+#ifndef PACKED_STRUCT
+# define PACKED_STRUCT(x) x
+#endif
+#ifndef PACKED_STRUCT_UNALIGNED
+# if UNALIGNED_WORD_ACCESS
+#   define PACKED_STRUCT_UNALIGNED(x) PACKED_STRUCT(x)
+# else
+#   define PACKED_STRUCT_UNALIGNED(x) x
+# endif
+#endif
+
 RUBY_SYMBOL_EXPORT_END
 
 #if defined(__cplusplus)
Index: configure.in
===================================================================
--- configure.in	(revision 46913)
+++ configure.in	(revision 46914)
@@ -1336,8 +1336,6 @@ AC_CACHE_CHECK(packed struct attribute, https://github.com/ruby/ruby/blob/trunk/configure.in#L1336
 packed_struct_unaligned=x
 if test "$rb_cv_packed_struct" != no; then
     AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], [$rb_cv_packed_struct])
-    AS_CASE(["$target_cpu"],
-	    [x86*|i?86|x64], [packed_struct_unaligned='PACKED_STRUCT(x)'])
 else
     AC_DEFINE_UNQUOTED([PACKED_STRUCT(x)], x)
 fi

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

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