Skip to content

Commit 02957fa

Browse files
committed
Speed up multiplication
1 parent bee39f2 commit 02957fa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/int256_t.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ class int256_t
157157

158158
if (low <= max64 &&
159159
other.low <= max64 &&
160-
high == other.high &&
161-
(high == 0 || high == -1))
160+
((high == 0 || high == -1) &&
161+
(other.high == 0 || other.high == -1)))
162162
{
163-
return int256_t(low * other.low, high);
163+
return int256_t(low * other.low,
164+
(high == other.high) ? 0 : -1);
164165
}
165166
else
166167
{

0 commit comments

Comments
 (0)