summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-12-21 08:49:23 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-12-21 08:57:17 +0900
commitf5537912abed308ad6967ae52bfa8699f14dae93 (patch)
treedfbc7fae3291155f8200684229f1aeca8485d4a4 /include
parent2fdb309e55b6f4ee5a0438aa25b5aac27da13fd4 (diff)
downloadmruby-f5537912abed308ad6967ae52bfa8699f14dae93.tar.gz
mruby-f5537912abed308ad6967ae52bfa8699f14dae93.zip
Define `MRB_ENDIAN_BIG` automatically; ref #4190
You had to define this macro on big endian platforms, but it is very error-prone. So define the macro automatically if possible.
Diffstat (limited to 'include')
-rw-r--r--include/mrbconf.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h
index cc28acfaa..553ed62cc 100644
--- a/include/mrbconf.h
+++ b/include/mrbconf.h
@@ -58,12 +58,16 @@
# endif
#endif
+/* define on big endian machines; used by MRB_NAN_BOXING, etc. */
+#ifndef MRB_ENDIAN_BIG
+# if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
+# define MRB_ENDIAN_BIG
+# endif
+#endif
+
/* represent mrb_value in boxed double; conflict with MRB_USE_FLOAT and MRB_WITHOUT_FLOAT */
//#define MRB_NAN_BOXING
-/* define on big endian machines; used by MRB_NAN_BOXING */
-//#define MRB_ENDIAN_BIG
-
/* represent mrb_value as a word (natural unit of data for the processor) */
//#define MRB_WORD_BOXING