From: Marko Kreen Date: Wed, 9 Jul 2014 17:03:55 +0000 (+0300) Subject: endian: WORDS_UNALIGNED_ACCESS_OK (draft) X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=8f82633a4982943f906588ec741e69089a7d0333;p=libusual.git endian: WORDS_UNALIGNED_ACCESS_OK (draft) Seems it might be useful (mainly inside endian.h) for non-gcc/clang compilers, but needs proof. --- diff --git a/usual/endian.h b/usual/endian.h index 58d44e2..8291cde 100644 --- a/usual/endian.h +++ b/usual/endian.h @@ -41,6 +41,17 @@ #include #endif +/* + * Is unaligned access to integers OK? Does not apply to floats. + * + * OK: x86, amd64, arm >= v6, ppc + */ +#if defined(__amd64__) || defined(__i386__) || defined(__ppc__) || defined(__ppc64__) \ + || defined(__ARM_FEATURE_UNALIGNED) \ + || defined(_M_IX86) || defined(_M_X64) || defined(_M_PPC) \ + || (defined(_M_ARM) && _M_ARM >= 6) +#define WORDS_UNALIGNED_ACCESS_OK +#endif /* * Ignore OS defines, as they may define only some subset of functions.