summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-21 06:28:41 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-21 06:28:41 +0000
commit05571e54db6afe5c1bee728d740ced58e5297921 (patch)
tree7bfa8884513b452aa59cb755702d9c9206f5ca4f
parente4a7a42fd54b54852891e45af04ce3653cc1c0a3 (diff)
* 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/branches/ruby_1_8@9432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--bignum.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 12651b1..4c906cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Oct 21 15:27:17 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 09:37:15 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* lib/mkmf.rb (create_makefile): Borland make seems not to allow
diff --git a/bignum.c b/bignum.c
index 043e799..536779bb 100644
--- a/bignum.c
+++ b/bignum.c
@@ -46,7 +46,7 @@ bignew_1(klass, len, 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);
@@ -1088,7 +1088,7 @@ bigsub(x, 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++) {