diff --git a/vm/math.hpp b/vm/math.hpp index 7828aa3e6c..cb4f1b1101 100644 --- a/vm/math.hpp +++ b/vm/math.hpp @@ -42,7 +42,7 @@ PRIMITIVE(bignum_bitp); PRIMITIVE(bignum_log2); PRIMITIVE(byte_array_to_bignum); -inline static cell allot_integer(fixnum x) +inline cell factorvm::allot_integer(fixnum x) { if(x < fixnum_min || x > fixnum_max) return tag(fixnum_to_bignum(x)); @@ -50,7 +50,12 @@ inline static cell allot_integer(fixnum x) return tag_fixnum(x); } -inline static cell allot_cell(cell x) +inline cell allot_integer(fixnum x) +{ + return vm->allot_integer(x); +} + +inline cell factorvm::allot_cell(cell x) { if(x > (cell)fixnum_max) return tag(cell_to_bignum(x)); @@ -58,6 +63,11 @@ inline static cell allot_cell(cell x) return tag_fixnum(x); } +inline cell allot_cell(cell x) +{ + return vm->allot_cell(x); +} + cell unbox_array_size(); inline static double untag_float(cell tagged) @@ -70,33 +80,48 @@ inline static double untag_float_check(cell tagged) return untag_check(tagged)->n; } -inline static cell allot_float(double n) +inline cell factorvm::allot_float(double n) { boxed_float *flo = allot(sizeof(boxed_float)); flo->n = n; return tag(flo); } +inline cell allot_float(double n) +{ + return vm->allot_float(n); +} + inline static fixnum float_to_fixnum(cell tagged) { return (fixnum)untag_float(tagged); } -inline static bignum *float_to_bignum(cell tagged) +inline bignum *factorvm::float_to_bignum(cell tagged) { return double_to_bignum(untag_float(tagged)); } -inline static double fixnum_to_float(cell tagged) +inline bignum *float_to_bignum(cell tagged) +{ + return vm->float_to_bignum(tagged); +} + +inline double fixnum_to_float(cell tagged) { return (double)untag_fixnum(tagged); } -inline static double bignum_to_float(cell tagged) +inline double factorvm::bignum_to_float(cell tagged) { return bignum_to_double(untag(tagged)); } +inline double bignum_to_float(cell tagged) +{ + return vm->bignum_to_float(tagged); +} + PRIMITIVE(fixnum_to_float); PRIMITIVE(bignum_to_float); PRIMITIVE(str_to_float); diff --git a/vm/vm.hpp b/vm/vm.hpp index 0389817bb9..5db239626d 100644 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -246,7 +246,6 @@ struct factorvm { cell allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_); inline void vmprim_resize_array(); inline void set_array_nth(array *array, cell slot, cell value); - // next method here: //strings cell string_nth(string* str, cell index); @@ -358,6 +357,12 @@ struct factorvm { void overflow_fixnum_add(fixnum x, fixnum y); void overflow_fixnum_subtract(fixnum x, fixnum y); void overflow_fixnum_multiply(fixnum x, fixnum y); + inline cell allot_integer(fixnum x); + inline cell allot_cell(cell x); + inline cell allot_float(double n); + inline bignum *float_to_bignum(cell tagged); + inline double bignum_to_float(cell tagged); + // next method here: //io void init_c_io();