diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-03-28 12:22:05 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-03-28 12:22:05 -0700 |
commit | 8035afae874e21ab85a4837973e320aa4a92182d (patch) | |
tree | 39366d98e8f6a2b6e14152400ba245d7da5e816a | |
parent | 284e5d83b50dc99dbc916237f26915bcce745960 (diff) | |
download | infinitytier-8035afae874e21ab85a4837973e320aa4a92182d.tar.gz infinitytier-8035afae874e21ab85a4837973e320aa4a92182d.zip |
Try to define ZT_NO_TYPE_PUNNING on iOS in case it wasn't.
-rw-r--r-- | node/Constants.hpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/node/Constants.hpp b/node/Constants.hpp index 12a052b9..90ac5c61 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -51,8 +51,19 @@ #include <endian.h> #endif -// Disable type punning on ARM architecture -- some ARM chips throw SIGBUS on unaligned access -#if defined(__arm__) || defined(__ARMEL__) +#ifdef __APPLE__ +#include <TargetConditionals.h> +#ifndef __UNIX_LIKE__ +#define __UNIX_LIKE__ +#endif +#ifndef __BSD__ +#define __BSD__ +#endif +#endif + +// Defined this macro to disable "type punning" on a number of targets that +// have issues with unaligned memory access. +#if defined(__arm__) || defined(__ARMEL__) || (defined(__APPLE__) && ( (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0)) || (defined(TARGET_OS_WATCH) && (TARGET_OS_WATCH != 0)) || (defined(TARGET_IPHONE_SIMULATOR) && (TARGET_IPHONE_SIMULATOR != 0)) ) ) #ifndef ZT_NO_TYPE_PUNNING #define ZT_NO_TYPE_PUNNING #endif @@ -73,18 +84,6 @@ #endif #endif -// TODO: Android is what? Linux technically, but does it define it? - -#ifdef __APPLE__ -#include <TargetConditionals.h> -#ifndef __UNIX_LIKE__ -#define __UNIX_LIKE__ -#endif -#ifndef __BSD__ -#define __BSD__ -#endif -#endif - #if defined(_WIN32) || defined(_WIN64) #ifndef __WINDOWS__ #define __WINDOWS__ |