private static UInt64[] Div(UInt64[] ll) { List<UInt64> b10 = new List<UInt64>(); int ubound = ll.GetUpperBound(0); int idx = 0; UInt64 l = 0, m = 0, d = 0; bool first = true; while (idx <= ubound) { l = ll[idx] + m; m = l % base32_10; d = l / base32_10; if (!(first && d == 0)) { b10.Add(d); first = false; } m *= base32; ++idx; } return b10.ToArray(); }
private static UInt64 Mod(UInt64[] ll) { int ubound = ll.GetUpperBound(0); int idx = 0; UInt64 l = 0; UInt64 ret = ll[ubound] % base32_10; while (idx < ubound) { l = ll[idx] % base32_10; l *= GetBaseMod(ubound - idx); l %= base32_10; ret += l; ++idx; } return ret % base32_10; }