diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-23 14:50:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-23 14:50:02 +0000 |
commit | 6528ad097135cf0a18c6e313217474935670a928 (patch) | |
tree | 3c7fc3d2c2c1416811f525b8991d2772fe29a4d5 | |
parent | 3f21aa5d386100dcf7f133a0debd3f0094713c0d (diff) | |
download | ruby-6528ad097135cf0a18c6e313217474935670a928.tar.gz |
defines.h: PACKED_STRUCT_UNALIGNED
* include/ruby/defines.h (PACKED_STRUCT_UNALIGNED): move from
configure.in for universal binary.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | include/ruby/defines.h | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/configure.in b/configure.in index 145b34de94..2cbe36f7cc 100644 --- a/configure.in +++ b/configure.in @@ -1336,8 +1336,6 @@ AC_CACHE_CHECK(packed struct attribute, rb_cv_packed_struct, 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 diff --git a/include/ruby/defines.h b/include/ruby/defines.h index b84e4f5ad2..0a192d70d2 100644 --- a/include/ruby/defines.h +++ b/include/ruby/defines.h @@ -261,6 +261,26 @@ void rb_ia64_flushrs(void); 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) |