diff options
-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) |