From d03d2ad5519baae17e77ab54ccd9aa32ca5bde16 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 29 Sep 2023 19:31:38 +0100 Subject: [PATCH] code-comments --- src/openpower/test/bigint/powmod.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openpower/test/bigint/powmod.py b/src/openpower/test/bigint/powmod.py index 72fc239c..8cdeeabd 100644 --- a/src/openpower/test/bigint/powmod.py +++ b/src/openpower/test/bigint/powmod.py @@ -111,14 +111,15 @@ def python_mul_algorithm2(a, b): iyl.append((iy+i, i==4)) il.append(i) - y = [0] * 8 - t = [0] * 8 + y = [0] * 8 # result y and temp t of same size + t = [0] * 8 # no need after this to set t[4] to zero for iy in range(4): - for i in range(4): + for i in range(4): # use t[iy+4] as a 64-bit carry t[iy+i], t[iy+4] = maddedu(a[iy], b[i], t[iy+4]) ca = 0 - for i in range(5): - y[iy + i], ca = adde(y[iy + i], t[iy+i], ca) + for i in range(5): # add vec t to y with 1-bit carry + idx = iy + i + y[idx], ca = adde(y[idx], t[idx], ca) return y -- 2.30.2