ref: 72ad21bc126ddcf29780bba789a3fbc7d8d34ff8
parent: def799e175eb9cd20b9cab16dcdca22e1d0bbc29
author: Ori Bernstein <[email protected]>
date: Wed Jan 22 13:39:54 EST 2014
Work around oversized int error. Should fix that soon.
--- a/libstd/bigint.myr
+++ b/libstd/bigint.myr
@@ -316,7 +316,6 @@
/* a /= b */
const bigdivmod = {a : bigint#, b : bigint# -> [bigint#, bigint#]
- const B = (1ul << 32)
/*var u, v /* normalized a and b */*/
var q/*, qhat /* quotient and estimated quotient */*/
/*
@@ -346,7 +345,7 @@
for j = a.dig.len; j > 0; j--
aj = (a.dig[j - 1] castto(uint64))
q.dig[j - 1] = (((carry << 32) + aj)/b0) castto(uint32)
- carry = carry*B + aj - (q.dig[j-1] castto(uint64))*b0
+ carry = (carry << 32) + aj - (q.dig[j-1] castto(uint64))*b0
;;
for v in q.dig
;;