diff options
| author | gingerBill <bill@gingerbill.org> | 2017-12-12 23:39:20 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-12-12 23:39:20 +0000 |
| commit | 367013f589b2ae87a0b83410bc4ea770e1263157 (patch) | |
| tree | 74683b63a606055a6fd8ae172de428c5fd4c2ece /src/integer128.cpp | |
| parent | c980a30bad9fc98c21e4ea36b4e27568650cd601 (diff) | |
Change Map and PtrSet grow rate
Diffstat (limited to 'src/integer128.cpp')
| -rw-r--r-- | src/integer128.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/integer128.cpp b/src/integer128.cpp index e9a0cb1ca..583c67281 100644 --- a/src/integer128.cpp +++ b/src/integer128.cpp @@ -491,6 +491,11 @@ void u128_divide(u128 a, u128 b, u128 *quo, u128 *rem) { if (rem) *rem = U128_ZERO; return; } + if (a.hi == 0 && b.hi == 0) { + if (quo) *quo = u128_from_u64(a.lo/b.lo); + if (rem) *rem = u128_from_u64(a.lo%b.lo); + return; + } u128 r = a; u128 d = b; u128 x = U128_ONE; @@ -670,7 +675,7 @@ i128 i128_mul(i128 a, i128 b) { } void i128_divide(i128 a, i128 b, i128 *quo_, i128 *rem_) { - // TODO(bill): Optimize this i128 division calculation + // IMPORTANT TODO(bill): Optimize this i128 division calculation i128 iquo = {0}; i128 irem = {0}; if (a.hi == 0 && b.hi == 0) { |