diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-08-05 07:52:15 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 16:21:26 +0900 |
| commit | 1eb71b008f3bef36449007aec239119e74314dac (patch) | |
| tree | 30220e28a61c97881cf3335e689d871a5aa3943b /include | |
| parent | 84a68ca5aeb5fa29543fb23eeda717bcb8a131fe (diff) | |
| download | mruby-1eb71b008f3bef36449007aec239119e74314dac.tar.gz mruby-1eb71b008f3bef36449007aec239119e74314dac.zip | |
Change default boxing scheme from `MRB_NO_BOXING`.
On 64bit platforms: `MRB_NAN_BOXING`
On 32bit platforms: `MRB_WORD_BOXING`
On debugging: `MRB_NO_BOXING`
Diffstat (limited to 'include')
| -rw-r--r-- | include/mrbconf.h | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h index 1cf72ece9..0d3d1ae5a 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -53,12 +53,41 @@ # 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) || \ + (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __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 + +/* represent mrb_value as a word (natural unit of data for the processor) */ +//#define MRB_WORD_BOXING + +/* with MRB_WORD_BOXING, embed float values in mrb_value (dropping 2 bit precision) */ +//#define MRB_WBOX_FLOAT_INLINE + +/* represent mrb_value as a struct; occupies 2 words */ +//#define MRB_NO_BOXING + +/* if no specific boxing type is chosen */ +#if !defined(MRB_NAN_BOXING) && !defined(MRB_WORD_BOXING) && !defined(MRB_NO_BOXING) +# if defined(MRB_64BIT) && !defined(MRB_INT64) +# define MRB_NAN_BOXING +# else +# define MRB_WORD_BOXING +# endif +#endif + /* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64; Default for 32-bit CPU mode. */ //#define MRB_INT32 /* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT32; - Default for 64-bit CPU mode. */ + Default for 64-bit CPU mode (unless using MRB_NAN_BOXING). */ //#define MRB_INT64 /* if no specific integer type is chosen */ @@ -72,20 +101,6 @@ # 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) || \ - (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __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 - -/* represent mrb_value as a word (natural unit of data for the processor) */ -//#define MRB_WORD_BOXING - /* string class to handle UTF-8 encoding */ //#define MRB_UTF8_STRING |
