зеркало из https://github.com/github/ruby.git
* bignum.c (bignew_1): convertion from `int' to `char' discards
upper bits, (ie. (char)0xff00 -> 0) so it's better to test if nonzero and set 0 or 1 instead of simply casting ... as a flag usage. (but I believe this won't cause actual bug in current implementation) [ruby-dev:27055] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9857cc6036
Коммит
ee2434851b
|
@ -1,3 +1,11 @@
|
|||
Fri Oct 21 15:23:23 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||
|
||||
* bignum.c (bignew_1): convertion from `int' to `char' discards
|
||||
upper bits, (ie. (char)0xff00 -> 0) so it's better to test if
|
||||
nonzero and set 0 or 1 instead of simply casting ... as a flag usage.
|
||||
(but I believe this won't cause actual bug in current implementation)
|
||||
[ruby-dev:27055]
|
||||
|
||||
Thu Oct 20 22:22:49 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parser.y (struct parser_params): parser never modify input string.
|
||||
|
|
8
bignum.c
8
bignum.c
|
@ -43,7 +43,7 @@ bignew_1(VALUE klass, long len, int sign)
|
|||
{
|
||||
NEWOBJ(big, struct RBignum);
|
||||
OBJSETUP(big, klass, T_BIGNUM);
|
||||
big->sign = (char)sign;
|
||||
big->sign = sign?1:0;
|
||||
big->len = len;
|
||||
big->digits = ALLOC_N(BDIGIT, len);
|
||||
|
||||
|
@ -693,7 +693,7 @@ rb_big_to_s(int argc, VALUE *argv, VALUE x)
|
|||
}
|
||||
|
||||
static unsigned long
|
||||
big2ulong(VALUE x, char *type, int check)
|
||||
big2ulong(VALUE x, const char *type, int check)
|
||||
{
|
||||
long len = RBIGNUM(x)->len;
|
||||
BDIGIT_DBL num;
|
||||
|
@ -752,7 +752,7 @@ rb_big2long(VALUE x)
|
|||
#if HAVE_LONG_LONG
|
||||
|
||||
static unsigned LONG_LONG
|
||||
big2ull(VALUE x, char *type)
|
||||
big2ull(VALUE x, const char *type)
|
||||
{
|
||||
long len = RBIGNUM(x)->len;
|
||||
BDIGIT_DBL num;
|
||||
|
@ -1040,7 +1040,7 @@ bigsub(VALUE x, VALUE y)
|
|||
}
|
||||
}
|
||||
|
||||
z = bignew(RBIGNUM(x)->len, (z == 0)?1:0);
|
||||
z = bignew(RBIGNUM(x)->len, z==0);
|
||||
zds = BDIGITS(z);
|
||||
|
||||
for (i = 0, num = 0; i < RBIGNUM(y)->len; i++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче