Merge pull request #1828 from take-cheeze/string_embed

Use sizeof(void*) instead of mrb_int size and extend embed string size.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-03-08 15:01:42 +09:00
+2 -9
View File
@@ -15,14 +15,7 @@ extern "C" {
extern const char mrb_digitmap[];
/* (sizeof(mrb_int)*2+sizeof(char*))/sizeof(char)-1 */
#if defined(MRB_INT16)
# define RSTRING_EMBED_LEN_MAX 9
#elif defined(MRB_INT64)
# define RSTRING_EMBED_LEN_MAX 15
#else
# define RSTRING_EMBED_LEN_MAX 11
#endif
#define RSTRING_EMBED_LEN_MAX (sizeof(void*) * 3 - 1)
struct RString {
MRB_OBJECT_HEADER;
@@ -58,7 +51,7 @@ struct RString {
#define MRB_STR_SHARED 1
#define MRB_STR_NOFREE 2
#define MRB_STR_EMBED 4
#define MRB_STR_EMBED_LEN_MASK 120
#define MRB_STR_EMBED_LEN_MASK 0xf8
#define MRB_STR_EMBED_LEN_SHIFT 3
void mrb_gc_free_str(mrb_state*, struct RString*);