]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: don't ctx-pop() in bignum_divmod.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 22 Mar 2013 15:26:01 +0000 (08:26 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 22 Mar 2013 15:26:01 +0000 (08:26 -0700)
vm/math.cpp

index 7cb4189bebdb7c4091f68af17e769073461baf3a..29a2f86304ebbf96187717aa7e95cff5032db5e4 100755 (executable)
@@ -140,11 +140,14 @@ void factor_vm::primitive_bignum_divint()
 
 void factor_vm::primitive_bignum_divmod()
 {
+       cell *s0 = (cell *)(ctx->datastack);
+       cell *s1 = (cell *)(ctx->datastack - sizeof(cell));
+       bignum *y = untag<bignum>(*s0);
+       bignum *x = untag<bignum>(*s1);
        bignum *q, *r;
-       POP_BIGNUMS(x,y);
-       bignum_divide(x,y,&q,&r);
-       ctx->replace(tag<bignum>(q));
-       ctx->push(tag<bignum>(r));
+       bignum_divide(x, y, &q, &r);
+       *s1 = tag<bignum>(q);
+       *s0 = tag<bignum>(r);
 }
 
 void factor_vm::primitive_bignum_mod()