mrubyを超漢字で動作させる
リビジョン | e35c3aff83d400dfe27fe105b7e282ac81b1197a (tree) |
---|---|
日時 | 2015-09-03 00:14:37 |
作者 | Yukihiro "Matz" Matsumoto <matz@ruby...> |
コミッター | Yukihiro "Matz" Matsumoto |
unsigned long may be smaller than mrb_int; use uint64_t instead; fix #2935
@@ -73,7 +73,7 @@ mrb_fix2binstr(mrb_state *mrb, mrb_value x, int base) | ||
73 | 73 | { |
74 | 74 | char buf[64], *b = buf + sizeof buf; |
75 | 75 | mrb_int num = mrb_fixnum(x); |
76 | - unsigned long val = (unsigned long)num; | |
76 | + uint64_t val = (uint64_t)num; | |
77 | 77 | char d; |
78 | 78 | |
79 | 79 | if (base != 2) { |
@@ -1863,7 +1863,7 @@ mrb_cstr_to_inum(mrb_state *mrb, const char *str, int base, int badcheck) | ||
1863 | 1863 | const char *p; |
1864 | 1864 | char sign = 1; |
1865 | 1865 | int c, uscore; |
1866 | - unsigned long n = 0; | |
1866 | + uint64_t n = 0; | |
1867 | 1867 | mrb_int val; |
1868 | 1868 | |
1869 | 1869 | #define conv_digit(c) \ |
@@ -1983,9 +1983,9 @@ mrb_cstr_to_inum(mrb_state *mrb, const char *str, int base, int badcheck) | ||
1983 | 1983 | } |
1984 | 1984 | n *= base; |
1985 | 1985 | n += c; |
1986 | - } | |
1987 | - if (n > MRB_INT_MAX) { | |
1988 | - mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer", mrb_str_new_cstr(mrb, str)); | |
1986 | + if (n > MRB_INT_MAX) { | |
1987 | + mrb_raisef(mrb, E_ARGUMENT_ERROR, "string (%S) too big for integer", mrb_str_new_cstr(mrb, str)); | |
1988 | + } | |
1989 | 1989 | } |
1990 | 1990 | val = n; |
1991 | 1991 | if (badcheck) { |