boxing_word.h: rename configuration macro name.
`MRB_WORDBOX_USE_HEAP_FLOAT` instead of `MRB_USE_FLOAT_FULL_PRECISION`.
MODIFY
include/mrbconf.h
include/mrbconf.h
#error Cannot define MRB_USE_FLOAT32 and MRB_NO_FLOAT at the same time
#endif
-/* if defined mruby allocates Float objects in the heap to keep full precision if needed */
-//#define MRB_USE_FLOAT_FULL_PRECISION
-
/* add -DMRB_NO_METHOD_CACHE to disable method cache to save memory */
//#define MRB_NO_METHOD_CACHE
/* size of the method cache (need to be the power of 2) */
# define MRB_WORD_BOXING
#endif
+/* if defined mruby allocates Float objects in the heap to keep full precision if needed */
+//#define MRB_WORDBOX_USE_HEAP_FLOAT
+
/* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64;
Default for 32-bit CPU mode. */
//#define MRB_INT32

MODIFY
include/mruby/boxing_word.h
include/mruby/boxing_word.h
#ifndef MRUBY_BOXING_WORD_H
#define MRUBY_BOXING_WORD_H
-#if defined(MRB_32BIT) && !defined(MRB_USE_FLOAT_FULL_PRECISION) && !defined(MRB_USE_FLOAT32)
-# define MRB_USE_FLOAT_FULL_PRECISION
+#if defined(MRB_32BIT) && !defined(MRB_USE_FLOAT32)
+# define MRB_WORDBOX_USE_HEAP_FLOAT
#endif
-#if !defined(MRB_NO_FLOAT) && defined(MRB_USE_FLOAT_FULL_PRECISION)
+#if !defined(MRB_NO_FLOAT) && defined(MRB_WORDBOX_USE_HEAP_FLOAT)
struct RFloat {
MRB_OBJECT_HEADER;
mrb_float f;
@@ -50,7 +50,7 @@ enum mrb_special_consts {
#define BOXWORD_FIXNUM_FLAG (1 << (BOXWORD_FIXNUM_BIT_POS - 1))
#define BOXWORD_FIXNUM_MASK ((1 << BOXWORD_FIXNUM_BIT_POS) - 1)
-#if defined(MRB_USE_FLOAT_FULL_PRECISION)
+#if defined(MRB_WORDBOX_USE_HEAP_FLOAT)
/* floats are allocated in heaps */
#define BOXWORD_SYMBOL_BIT_POS 2
#define BOXWORD_SYMBOL_SHIFT BOXWORD_SYMBOL_BIT_POS
@@ -118,7 +118,7 @@ union mrb_value_ {
void *p;
struct RBasic *bp;
#ifndef MRB_NO_FLOAT
-#ifndef MRB_USE_FLOAT_FULL_PRECISION
+#ifndef MRB_WORDBOX_USE_HEAP_FLOAT
mrb_float f;
#else
struct RFloat *fp;
@@ -151,7 +151,7 @@ MRB_API mrb_value mrb_word_boxing_int_value(struct mrb_state*, mrb_int);
#define mrb_ptr(o) mrb_val_union(o).p
#define mrb_cptr(o) mrb_val_union(o).vp->p
#ifndef MRB_NO_FLOAT
-#ifndef MRB_USE_FLOAT_FULL_PRECISION
+#ifndef MRB_WORDBOX_USE_HEAP_FLOAT
MRB_API mrb_float mrb_word_boxing_value_float(mrb_value v);
#define mrb_float(o) mrb_word_boxing_value_float(o)
#else
@@ -176,7 +176,7 @@ mrb_integer_func(mrb_value o) {
#define mrb_false_p(o) ((o).w == MRB_Qfalse)
#define mrb_true_p(o) ((o).w == MRB_Qtrue)
#ifndef MRB_NO_FLOAT
-#ifndef MRB_USE_FLOAT_FULL_PRECISION
+#ifndef MRB_WORDBOX_USE_HEAP_FLOAT
#define mrb_float_p(o) BOXWORD_SHIFT_VALUE_P(o, FLOAT)
#else
#define mrb_float_p(o) BOXWORD_OBJ_TYPE_P(o, FLOAT)

MODIFY
mrbgems/mruby-test/driver.c
mrbgems/mruby-test/driver.c
@@ -222,7 +222,7 @@ mrb_init_test_driver(mrb_state *mrb, mrb_bool verbose)
#ifndef MRB_NO_FLOAT
#ifdef MRB_USE_FLOAT32
-#ifdef MRB_USE_FLOAT_FULL_PRECISION
+#ifdef MRB_WORDBOX_USE_HEAP_FLOAT
mrb_define_const(mrb, mrbtest, "FLOAT_TOLERANCE", mrb_float_value(mrb, 1e-5));
#else
mrb_define_const(mrb, mrbtest, "FLOAT_TOLERANCE", mrb_float_value(mrb, 1e-4));

MODIFY
src/etc.c
src/etc.c
@@ -158,22 +158,22 @@ mrb_word_boxing_float_value(mrb_state *mrb, mrb_float f)
{
union mrb_value_ v;
-#ifndef MRB_USE_FLOAT_FULL_PRECISION
+#ifdef MRB_WORDBOX_USE_HEAP_FLOAT
+ v.p = mrb_obj_alloc(mrb, MRB_TT_FLOAT, mrb->float_class);
+ v.fp->f = f;
+ MRB_SET_FROZEN_FLAG(v.bp);
+#else
#if defined(MRB_64BIT) && defined(MRB_USE_FLOAT32)
v.w = 0;
#endif
v.f = f;
v.w = (v.w & ~3) | 2;
-#else
- v.p = mrb_obj_alloc(mrb, MRB_TT_FLOAT, mrb->float_class);
- v.fp->f = f;
- MRB_SET_FROZEN_FLAG(v.bp);
#endif
return v.value;
}
-#ifndef MRB_USE_FLOAT_FULL_PRECISION
+#ifndef MRB_WORDBOX_USE_HEAP_FLOAT
MRB_API mrb_float
mrb_word_boxing_value_float(mrb_value v)
{

MODIFY
src/symbol.c
src/symbol.c
@@ -73,7 +73,7 @@ static const char pack_table[] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS
static mrb_sym
sym_inline_pack(const char *name, size_t len)
{
-#if defined(MRB_WORD_BOXING) && defined(MRB_32BIT) && !defined(MRB_USE_FLOAT_FULL_PRECISION)
+#if defined(MRB_WORD_BOXING) && defined(MRB_32BIT) && !defined(MRB_WORDBOX_USE_HEAP_FLOAT)
const size_t pack_length_max = 4;
#else
const size_t pack_length_max = 5;

boxing_word.h: rename configuration macro name.

`MRB_WORDBOX_USE_HEAP_FLOAT` instead of `MRB_USE_FLOAT_FULL_PRECISION`.