зеркало из https://github.com/github/ruby.git
* numeric.c (rb_fix2str): detect unnormalized Fixnum value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9c9c46e5a3
Коммит
ae55ecc267
|
@ -1,3 +1,7 @@
|
|||
Sun Oct 2 02:03:06 2016 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* numeric.c (rb_fix2str): detect unnormalized Fixnum value.
|
||||
|
||||
Sat Oct 1 23:08:47 2016 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* ext/date/date_parse.c (date_zone_to_diff): it's nonsence and really
|
||||
|
|
11
numeric.c
11
numeric.c
|
@ -3267,6 +3267,17 @@ rb_fix2str(VALUE x, int base)
|
|||
if (base < 2 || 36 < base) {
|
||||
rb_raise(rb_eArgError, "invalid radix %d", base);
|
||||
}
|
||||
#if SIZEOF_LONG < SIZEOF_VOIDP
|
||||
# if SIZEOF_VOIDP == SIZEOF_LONG_LONG
|
||||
if ((val >= 0 && (x & 0xFFFFFFFF00000000ull)) ||
|
||||
(val < 0 && (x & 0xFFFFFFFF00000000ull) != 0xFFFFFFFF00000000ull)) {
|
||||
rb_bug("Unnormalized Fixnum value %p", x);
|
||||
}
|
||||
# elif
|
||||
/* should do something like above code, but currently ruby does not know */
|
||||
/* such platforms */
|
||||
# endif
|
||||
#endif
|
||||
if (val == 0) {
|
||||
return rb_usascii_str_new2("0");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче