From: lkcl Date: Sat, 19 Mar 2022 06:49:11 +0000 (+0000) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~3007 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=633d57457d98b8c6ab7803fe72050f8918bba87f;p=libreriscv.git --- diff --git a/openpower/sv/bitmanip/gfpinv.py b/openpower/sv/bitmanip/gfpinv.py index e75773abd..45b6dbbdd 100644 --- a/openpower/sv/bitmanip/gfpinv.py +++ b/openpower/sv/bitmanip/gfpinv.py @@ -16,12 +16,16 @@ def gfpinv(a): r = 0 s = 1 while v > 0: + # implementations could use count-zeros on + # both u and r to save cycles if u & 1 == 0: u >>= 1 if r & 1 == 0: r >>= 1 else: r = (r + p) >> 1 + # implementations could use count-zeros on + # both v and s to save cycles elif v & 1 == 0: v >>= 1 if s & 1 == 0: