diff --git a/vm/math.cpp b/vm/math.cpp index 7cb4189beb..29a2f86304 100755 --- a/vm/math.cpp +++ b/vm/math.cpp @@ -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(*s0); + bignum *x = untag(*s1); bignum *q, *r; - POP_BIGNUMS(x,y); - bignum_divide(x,y,&q,&r); - ctx->replace(tag(q)); - ctx->push(tag(r)); + bignum_divide(x, y, &q, &r); + *s1 = tag(q); + *s0 = tag(r); } void factor_vm::primitive_bignum_mod()