summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/bignum.c b/bignum.c
index 770e86ad80..6b0e78729b 100644
--- a/bignum.c
+++ b/bignum.c
@@ -26,7 +26,7 @@ typedef unsigned short USHORT;
static VALUE
bignew_1(klass, len, sign)
VALUE klass;
- size_t len;
+ int len;
char sign;
{
NEWOBJ(big, struct RBignum);
@@ -79,7 +79,7 @@ static VALUE
bignorm(x)
VALUE x;
{
- size_t len = RBIGNUM(x)->len;
+ int len = RBIGNUM(x)->len;
USHORT *ds = BDIGITS(x);
while (len-- && !ds[len]) ;
@@ -170,7 +170,7 @@ rb_str2inum(str, base)
{
char sign = 1, c;
unsigned long num;
- size_t len, blen = 1;
+ int len, blen = 1;
int i;
VALUE z;
USHORT *zds;
@@ -352,7 +352,7 @@ rb_big2ulong(x)
VALUE x;
{
unsigned long num;
- size_t len = RBIGNUM(x)->len;
+ int len = RBIGNUM(x)->len;
USHORT *ds;
if (len > sizeof(long)/sizeof(USHORT))
@@ -417,7 +417,7 @@ rb_big2dbl(x)
VALUE x;
{
double d = 0.0;
- size_t i = RBIGNUM(x)->len;
+ int i = RBIGNUM(x)->len;
USHORT *ds = BDIGITS(x);
while (i--) {
@@ -438,7 +438,7 @@ static VALUE
rb_big_cmp(x, y)
VALUE x, y;
{
- size_t xlen = RBIGNUM(x)->len;
+ int xlen = RBIGNUM(x)->len;
switch (TYPE(y)) {
case T_FIXNUM:
@@ -490,7 +490,7 @@ rb_big_neg(x)
VALUE x;
{
VALUE z = rb_big_clone(x);
- size_t i = RBIGNUM(x)->len;
+ int i = RBIGNUM(x)->len;
USHORT *ds = BDIGITS(z);
if (!RBIGNUM(x)->sign) rb_big_2comp(z);
@@ -508,7 +508,7 @@ bigsub(x, y)
VALUE z = 0;
USHORT *zds;
long num;
- size_t i;
+ int i;
i = RBIGNUM(x)->len;
/* if x is larger than y, swap */
@@ -556,7 +556,7 @@ bigadd(x, y, sign)
{
VALUE z;
long num;
- size_t i, len;
+ int i, len;
sign = (sign == RBIGNUM(y)->sign);
if (RBIGNUM(x)->sign != sign) {
@@ -636,7 +636,7 @@ VALUE
rb_big_mul(x, y)
VALUE x, y;
{
- size_t i, j;
+ int i, j;
unsigned long n = 0;
VALUE z;
USHORT *zds;
@@ -685,11 +685,11 @@ bigdivmod(x, y, div, mod, modulo)
VALUE *div, *mod;
int modulo;
{
- size_t nx = RBIGNUM(x)->len, ny = RBIGNUM(y)->len;
+ int nx = RBIGNUM(x)->len, ny = RBIGNUM(y)->len;
int i, j;
VALUE yy, z;
USHORT *xds, *yds, *zds, *tds;
- size_t t2;
+ unsigned long t2;
long num;
USHORT dd, q;
@@ -714,7 +714,7 @@ bigdivmod(x, y, div, mod, modulo)
if (div) *div = bignorm(z);
if (mod) {
if (!RBIGNUM(y)->sign) t2 = -(long)t2;
- *mod = INT2FIX(t2);
+ *mod = INT2NUM(t2);
}
return;
}
@@ -798,7 +798,7 @@ bigdivmod(x, y, div, mod, modulo)
RBIGNUM(*mod)->len = ny;
RBIGNUM(*mod)->sign = RBIGNUM(x)->sign;
if (modulo && RBIGNUM(x)->sign != RBIGNUM(y)->sign) {
- size_t len = ny;
+ int len = ny;
zds = BDIGITS(*mod);
while (len-- && !zds[len]);
if (len > 0) {
@@ -953,7 +953,7 @@ rb_big_and(x, y)
{
VALUE z;
USHORT *ds1, *ds2, *zds;
- size_t i, l1, l2;
+ int i, l1, l2;
char sign;
if (FIXNUM_P(y)) {
@@ -1112,11 +1112,11 @@ rb_big_lshift(x, y)
{
USHORT *xds, *zds;
int shift = NUM2INT(y);
- size_t s1 = shift/BITSPERDIG;
- size_t s2 = shift%BITSPERDIG;
+ int s1 = shift/BITSPERDIG;
+ int s2 = shift%BITSPERDIG;
VALUE z;
unsigned long num = 0;
- size_t len, i;
+ int len, i;
if (shift < 0) return rb_big_rshift(x, INT2FIX(-shift));
xds = BDIGITS(x);
@@ -1141,12 +1141,12 @@ rb_big_rshift(x, y)
{
USHORT *xds, *zds;
int shift = NUM2INT(y);
- size_t s1 = shift/BITSPERDIG;
- size_t s2 = shift%BITSPERDIG;
+ int s1 = shift/BITSPERDIG;
+ int s2 = shift%BITSPERDIG;
VALUE z;
unsigned long num = 0;
- size_t i = RBIGNUM(x)->len;
- size_t j;
+ int i = RBIGNUM(x)->len;
+ int j;
if (shift < 0) return rb_big_lshift(x, INT2FIX(-shift));
if (s1 > RBIGNUM(x)->len) {
@@ -1173,7 +1173,7 @@ rb_big_aref(x, y)
{
USHORT *xds;
int shift = NUM2INT(y);
- size_t s1, s2;
+ int s1, s2;
if (shift < 0) return INT2FIX(0);
s1 = shift/BITSPERDIG;
@@ -1197,7 +1197,7 @@ static VALUE
rb_big_hash(x)
VALUE x;
{
- size_t i, len;
+ int i, len;
int key;
USHORT *digits;
@@ -1243,7 +1243,7 @@ rb_big_rand(max)
VALUE max;
{
struct RBignum *v;
- size_t len;
+ int len;
len = RBIGNUM(max)->len;
v = RBIGNUM(bignew(len,1));