Constrain multiply word to prevent overflow.

The multiply runs does not need to do all the combinations of digit
products, because the higher ones cannot add into the result. Fix the
iteration to limit the scan.
This commit is contained in:
Stephen Williams 2008-05-29 14:00:03 -07:00
parent 2fab3159dd
commit 6f0d98cf18
1 changed files with 1 additions and 1 deletions

View File

@ -3032,7 +3032,7 @@ bool of_MUL(vthread_t thr, vvp_code_t cp)
res[idx] = 0;
for (unsigned mul_a = 0 ; mul_a < words ; mul_a += 1) {
for (unsigned mul_b = 0 ; mul_b < words ; mul_b += 1) {
for (unsigned mul_b = 0 ; mul_b < (words-mul_a) ; mul_b += 1) {
unsigned long sum;
unsigned long tmp = multiply_with_carry(ap[mul_a], bp[mul_b], sum);
unsigned base = mul_a + mul_b;