moved global state from math into vm
parent
839491a828
commit
efa974f025
|
@ -371,7 +371,7 @@ bignum *bignum_remainder(bignum * numerator, bignum * denominator)
|
|||
}
|
||||
|
||||
#define FOO_TO_BIGNUM(name,type,utype) \
|
||||
bignum * name##_to_bignum(type n) \
|
||||
bignum * factorvm::name##_to_bignum(type n) \
|
||||
{ \
|
||||
int negative_p; \
|
||||
bignum_digit_type result_digits [BIGNUM_DIGITS_FOR(type)]; \
|
||||
|
|
|
@ -55,10 +55,6 @@ bignum_divide(bignum * numerator, bignum * denominator,
|
|||
bignum * * quotient, bignum * * remainder);
|
||||
bignum * bignum_quotient(bignum *, bignum *);
|
||||
bignum * bignum_remainder(bignum *, bignum *);
|
||||
bignum * fixnum_to_bignum(fixnum);
|
||||
bignum * cell_to_bignum(cell);
|
||||
bignum * long_long_to_bignum(s64 n);
|
||||
bignum * ulong_long_to_bignum(u64 n);
|
||||
fixnum bignum_to_fixnum(bignum *);
|
||||
cell bignum_to_cell(bignum *);
|
||||
s64 bignum_to_long_long(bignum *);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
cell bignum_zero;
|
||||
cell bignum_pos_one;
|
||||
cell bignum_neg_one;
|
||||
|
||||
inline void factorvm::vmprim_bignum_to_fixnum()
|
||||
{
|
||||
drepl(tag_fixnum(bignum_to_fixnum(untag<bignum>(dpeek()))));
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
extern cell bignum_zero;
|
||||
extern cell bignum_pos_one;
|
||||
extern cell bignum_neg_one;
|
||||
|
||||
static const fixnum fixnum_max = (((fixnum)1 << (WORD_SIZE - TAG_BITS - 1)) - 1);
|
||||
static const fixnum fixnum_min = (-((fixnum)1 << (WORD_SIZE - TAG_BITS - 1)));
|
||||
static const fixnum array_size_max = ((cell)1 << (WORD_SIZE - TAG_BITS - 2));
|
||||
|
|
10
vm/vm.hpp
10
vm/vm.hpp
|
@ -243,6 +243,9 @@ struct factorvm {
|
|||
inline void check_tagged_pointer(cell tagged);
|
||||
|
||||
// local roots
|
||||
/* If a runtime function needs to call another function which potentially
|
||||
allocates memory, it must wrap any local variable references to Factor
|
||||
objects in gc_root instances */
|
||||
std::vector<cell> gc_locals;
|
||||
std::vector<cell> gc_bignums;
|
||||
|
||||
|
@ -329,10 +332,17 @@ struct factorvm {
|
|||
inline void vmprim_wrapper();
|
||||
|
||||
//math
|
||||
cell bignum_zero;
|
||||
cell bignum_pos_one;
|
||||
cell bignum_neg_one;
|
||||
inline void vmprim_bignum_to_fixnum();
|
||||
inline void vmprim_float_to_fixnum();
|
||||
inline void vmprim_fixnum_divint();
|
||||
inline void vmprim_fixnum_divmod();
|
||||
bignum *fixnum_to_bignum(fixnum);
|
||||
bignum *cell_to_bignum(cell);
|
||||
bignum *long_long_to_bignum(s64 n);
|
||||
bignum *ulong_long_to_bignum(u64 n);
|
||||
inline fixnum sign_mask(fixnum x);
|
||||
inline fixnum branchless_max(fixnum x, fixnum y);
|
||||
inline fixnum branchless_abs(fixnum x);
|
||||
|
|
Loading…
Reference in New Issue