updated function ptr calls (iterators etc..) to take a vm parameter
parent
d5da6a3d58
commit
d093ff766f
|
@ -1980,14 +1980,14 @@ int bignum_unsigned_logbitp(int shift, bignum * bignum)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocates memory */
|
/* Allocates memory */
|
||||||
bignum *factorvm::digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int), unsigned int radix, int negative_p)
|
bignum *factorvm::digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factorvm*), unsigned int radix, int negative_p)
|
||||||
{
|
{
|
||||||
BIGNUM_ASSERT ((radix > 1) && (radix <= BIGNUM_RADIX_ROOT));
|
BIGNUM_ASSERT ((radix > 1) && (radix <= BIGNUM_RADIX_ROOT));
|
||||||
if (n_digits == 0)
|
if (n_digits == 0)
|
||||||
return (BIGNUM_ZERO ());
|
return (BIGNUM_ZERO ());
|
||||||
if (n_digits == 1)
|
if (n_digits == 1)
|
||||||
{
|
{
|
||||||
fixnum digit = ((fixnum) ((*producer) (0)));
|
fixnum digit = ((fixnum) ((*producer) (0,this)));
|
||||||
return (fixnum_to_bignum (negative_p ? (- digit) : digit));
|
return (fixnum_to_bignum (negative_p ? (- digit) : digit));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -2009,14 +2009,14 @@ bignum *factorvm::digit_stream_to_bignum(unsigned int n_digits, unsigned int (*p
|
||||||
{
|
{
|
||||||
bignum_destructive_scale_up (result, ((bignum_digit_type) radix));
|
bignum_destructive_scale_up (result, ((bignum_digit_type) radix));
|
||||||
bignum_destructive_add
|
bignum_destructive_add
|
||||||
(result, ((bignum_digit_type) ((*producer) (n_digits))));
|
(result, ((bignum_digit_type) ((*producer) (n_digits,this))));
|
||||||
}
|
}
|
||||||
return (bignum_trim (result));
|
return (bignum_trim (result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bignum *digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int), unsigned int radix, int negative_p)
|
bignum *digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factorvm*), unsigned int radix, int negative_p)
|
||||||
{
|
{
|
||||||
return vm->digit_stream_to_bignum(n_digits,producer,radix,negative_p);
|
return vm->digit_stream_to_bignum(n_digits,producer,radix,negative_p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,8 +119,9 @@ void bignum_negate_magnitude(bignum *);
|
||||||
bignum * bignum_integer_length(bignum * arg1);
|
bignum * bignum_integer_length(bignum * arg1);
|
||||||
int bignum_unsigned_logbitp(int shift, bignum * bignum);
|
int bignum_unsigned_logbitp(int shift, bignum * bignum);
|
||||||
int bignum_logbitp(int shift, bignum * arg);
|
int bignum_logbitp(int shift, bignum * arg);
|
||||||
|
struct factorvm;
|
||||||
bignum * digit_stream_to_bignum(unsigned int n_digits,
|
bignum * digit_stream_to_bignum(unsigned int n_digits,
|
||||||
unsigned int (*producer)(unsigned int),
|
unsigned int (*producer)(unsigned int,factorvm*),
|
||||||
unsigned int radix,
|
unsigned int radix,
|
||||||
int negative_p);
|
int negative_p);
|
||||||
|
|
||||||
|
|
|
@ -359,9 +359,9 @@ unsigned int factorvm::bignum_producer(unsigned int digit)
|
||||||
return *(ptr + digit);
|
return *(ptr + digit);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int bignum_producer(unsigned int digit)
|
unsigned int bignum_producer(unsigned int digit, factorvm *myvm)
|
||||||
{
|
{
|
||||||
return vm->bignum_producer(digit);
|
return myvm->bignum_producer(digit);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void factorvm::vmprim_byte_array_to_bignum()
|
inline void factorvm::vmprim_byte_array_to_bignum()
|
||||||
|
|
|
@ -120,7 +120,7 @@ struct factorvm {
|
||||||
bignum *bignum_integer_length(bignum * x);
|
bignum *bignum_integer_length(bignum * x);
|
||||||
int bignum_logbitp(int shift, bignum * arg);
|
int bignum_logbitp(int shift, bignum * arg);
|
||||||
int bignum_unsigned_logbitp(int shift, bignum * bignum);
|
int bignum_unsigned_logbitp(int shift, bignum * bignum);
|
||||||
bignum *digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int), unsigned int radix, int negative_p);
|
bignum *digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factorvm *), unsigned int radix, int negative_p);
|
||||||
|
|
||||||
//data_heap
|
//data_heap
|
||||||
bool secure_gc; /* Set by the -securegc command line argument */
|
bool secure_gc; /* Set by the -securegc command line argument */
|
||||||
|
|
Loading…
Reference in New Issue