]> gitweb.factorcode.org Git - factor.git/commitdiff
moved more math.hpp inline functions to vm
authorPhil Dawes <phil@phildawes.net>
Mon, 17 Aug 2009 20:37:15 +0000 (21:37 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:25 +0000 (08:16 +0100)
vm/math.hpp
vm/vm.hpp

index 863fa1b4aff0186d8dddb9f97ad484aeeeefe693..4633721194507cb3808230e4496e01b8a2e2fc4b 100644 (file)
@@ -38,48 +38,8 @@ PRIMITIVE(bignum_bitp);
 PRIMITIVE(bignum_log2);
 PRIMITIVE(byte_array_to_bignum);
 
-
-
-
-
-
-
-
-
 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(bignum_to_float);
 PRIMITIVE(str_to_float);
index 0f7a26c020e6befa73b4d156e246e37a0b34de92..30b7395a70f5d2fa2b444ddf38a3e2c4cefa5e9e 100644 (file)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -406,6 +406,11 @@ struct factorvm {
        inline cell allot_float(double n);
        inline bignum *float_to_bignum(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
        void init_c_io();
@@ -534,7 +539,6 @@ struct factorvm {
        void save_callstack_bottom(stack_frame *callstack_bottom);
        template<typename T> void iterate_callstack(cell top, cell bottom, T &iterator);
        inline void do_slots(cell obj, void (* iter)(cell *,factorvm*));
-       // next method here:
 
 
        //alien
@@ -1060,6 +1064,47 @@ inline double bignum_to_float(cell 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
 /* This is a little tricky. The iterator may allocate memory, so we
 keep the callstack in a GC root and use relative offsets */