moved more math.hpp inline functions to vm
parent
a66cf7e609
commit
75c81af691
40
vm/math.hpp
40
vm/math.hpp
|
@ -38,48 +38,8 @@ PRIMITIVE(bignum_bitp);
|
||||||
PRIMITIVE(bignum_log2);
|
PRIMITIVE(bignum_log2);
|
||||||
PRIMITIVE(byte_array_to_bignum);
|
PRIMITIVE(byte_array_to_bignum);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cell unbox_array_size();
|
cell unbox_array_size();
|
||||||
|
|
||||||
inline static double untag_float(cell tagged)
|
|
||||||
{
|
|
||||||
return untag<boxed_float>(tagged)->n;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline static double untag_float_check(cell tagged)
|
|
||||||
{
|
|
||||||
return untag_check<boxed_float>(tagged)->n;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline static fixnum float_to_fixnum(cell tagged)
|
|
||||||
{
|
|
||||||
return (fixnum)untag_float(tagged);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline double fixnum_to_float(cell tagged)
|
|
||||||
{
|
|
||||||
return (double)untag_fixnum(tagged);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PRIMITIVE(fixnum_to_float);
|
PRIMITIVE(fixnum_to_float);
|
||||||
PRIMITIVE(bignum_to_float);
|
PRIMITIVE(bignum_to_float);
|
||||||
PRIMITIVE(str_to_float);
|
PRIMITIVE(str_to_float);
|
||||||
|
|
47
vm/vm.hpp
47
vm/vm.hpp
|
@ -406,6 +406,11 @@ struct factorvm {
|
||||||
inline cell allot_float(double n);
|
inline cell allot_float(double n);
|
||||||
inline bignum *float_to_bignum(cell tagged);
|
inline bignum *float_to_bignum(cell tagged);
|
||||||
inline double bignum_to_float(cell tagged);
|
inline double bignum_to_float(cell tagged);
|
||||||
|
inline double untag_float(cell tagged);
|
||||||
|
inline double untag_float_check(cell tagged);
|
||||||
|
inline fixnum float_to_fixnum(cell tagged);
|
||||||
|
inline double fixnum_to_float(cell tagged);
|
||||||
|
// next method here:
|
||||||
|
|
||||||
//io
|
//io
|
||||||
void init_c_io();
|
void init_c_io();
|
||||||
|
@ -534,7 +539,6 @@ struct factorvm {
|
||||||
void save_callstack_bottom(stack_frame *callstack_bottom);
|
void save_callstack_bottom(stack_frame *callstack_bottom);
|
||||||
template<typename T> void iterate_callstack(cell top, cell bottom, T &iterator);
|
template<typename T> void iterate_callstack(cell top, cell bottom, T &iterator);
|
||||||
inline void do_slots(cell obj, void (* iter)(cell *,factorvm*));
|
inline void do_slots(cell obj, void (* iter)(cell *,factorvm*));
|
||||||
// next method here:
|
|
||||||
|
|
||||||
|
|
||||||
//alien
|
//alien
|
||||||
|
@ -1060,6 +1064,47 @@ inline double bignum_to_float(cell tagged)
|
||||||
return vm->bignum_to_float(tagged);
|
return vm->bignum_to_float(tagged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline double factorvm::untag_float(cell tagged)
|
||||||
|
{
|
||||||
|
return untag<boxed_float>(tagged)->n;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double untag_float(cell tagged)
|
||||||
|
{
|
||||||
|
return vm->untag_float(tagged);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double factorvm::untag_float_check(cell tagged)
|
||||||
|
{
|
||||||
|
return untag_check<boxed_float>(tagged)->n;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double untag_float_check(cell tagged)
|
||||||
|
{
|
||||||
|
return vm->untag_float_check(tagged);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fixnum factorvm::float_to_fixnum(cell tagged)
|
||||||
|
{
|
||||||
|
return (fixnum)untag_float(tagged);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static fixnum float_to_fixnum(cell tagged)
|
||||||
|
{
|
||||||
|
return vm->float_to_fixnum(tagged);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double factorvm::fixnum_to_float(cell tagged)
|
||||||
|
{
|
||||||
|
return (double)untag_fixnum(tagged);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double fixnum_to_float(cell tagged)
|
||||||
|
{
|
||||||
|
return vm->fixnum_to_float(tagged);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//callstack.hpp
|
//callstack.hpp
|
||||||
/* This is a little tricky. The iterator may allocate memory, so we
|
/* This is a little tricky. The iterator may allocate memory, so we
|
||||||
keep the callstack in a GC root and use relative offsets */
|
keep the callstack in a GC root and use relative offsets */
|
||||||
|
|
Loading…
Reference in New Issue