From 4d3acc1feef06b246d89b72dd31c4454ebafdb65 Mon Sep 17 00:00:00 2001 From: lkcl Date: Sun, 6 Mar 2022 07:57:00 +0000 Subject: [PATCH] --- openpower/sv/bitmanip.mdwn | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index b7a54c7ff..898692464 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -664,10 +664,12 @@ def gf_degree(a) : return res def gf_invert(a, mod=0x1B) : + + mod_degree = gf_degree(mod) v = mod g1 = 1 g2 = 0 - j = gf_degree(a) - 8 + j = gf_degree(a) - mod_degree while (a != 1) : if (j < 0) : @@ -678,8 +680,8 @@ def gf_invert(a, mod=0x1B) : a ^= v << j g1 ^= g2 << j - a %= 256 # Emulating 8-bit overflow - g1 %= 256 # Emulating 8-bit overflow + a %= (1<