* bignum.c (BDIGMAX): Use BIGRAD.

(BIGLO): Use BDIGMAX.
  (bigdivrem1): Ditto.
  (bigor_int): Ditto.
  (rb_big_or): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-21 10:40:19 +00:00
parent 90be342c9f
commit c54a1abde3
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,11 @@
Fri Jun 21 19:38:37 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (BDIGMAX): Use BIGRAD.
(BIGLO): Use BDIGMAX.
(bigdivrem1): Ditto.
(bigor_int): Ditto.
(rb_big_or): Ditto.
Fri Jun 21 19:18:48 2013 Tanaka Akira <akr@fsij.org> Fri Jun 21 19:18:48 2013 Tanaka Akira <akr@fsij.org>
* pack.c (pack_pack): Move the implementation for 'c' directive after * pack.c (pack_pack): Move the implementation for 'c' directive after

View File

@ -45,8 +45,8 @@ static VALUE big_three = Qnil;
#endif #endif
#define BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG) #define BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG)
#define BIGDN(x) RSHIFT((x),BITSPERDIG) #define BIGDN(x) RSHIFT((x),BITSPERDIG)
#define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1))) #define BIGLO(x) ((BDIGIT)((x) & BDIGMAX))
#define BDIGMAX ((BDIGIT)-1) #define BDIGMAX ((BDIGIT)(BIGRAD-1))
#define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || \ #define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || \
(BDIGITS(x)[0] == 0 && \ (BDIGITS(x)[0] == 0 && \
@ -3834,7 +3834,7 @@ bigdivrem1(void *ptr)
bds->j = j; bds->j = j;
return 0; return 0;
} }
if (zds[j] == yds[ny-1]) q = (BDIGIT)BIGRAD-1; if (zds[j] == yds[ny-1]) q = BDIGMAX;
else q = (BDIGIT)((BIGUP(zds[j]) + zds[j-1])/yds[ny-1]); else q = (BDIGIT)((BIGUP(zds[j]) + zds[j-1])/yds[ny-1]);
if (q) { if (q) {
i = bds->nyzero; num = 0; t2 = 0; i = bds->nyzero; num = 0; t2 = 0;
@ -4542,7 +4542,7 @@ bigor_int(VALUE x, long y)
} }
#endif #endif
while (i < xn) { while (i < xn) {
zds[i] = sign?xds[i]:(BDIGIT)(BIGRAD-1); zds[i] = sign?xds[i]:BDIGMAX;
i++; i++;
} }
if (!RBIGNUM_SIGN(z)) get2comp(z); if (!RBIGNUM_SIGN(z)) get2comp(z);
@ -4603,7 +4603,7 @@ rb_big_or(VALUE xx, VALUE yy)
zds[i] = ds1[i] | ds2[i]; zds[i] = ds1[i] | ds2[i];
} }
for (; i<l2; i++) { for (; i<l2; i++) {
zds[i] = sign?ds2[i]:(BDIGIT)(BIGRAD-1); zds[i] = sign?ds2[i]:BDIGMAX;
} }
if (!RBIGNUM_SIGN(z)) get2comp(z); if (!RBIGNUM_SIGN(z)) get2comp(z);
return bignorm(z); return bignorm(z);