From c771730420ffc9a670ec81dbad0fc6e141c5ae60 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 26 Apr 2022 15:18:08 +0100 Subject: [PATCH] split out bigshift --- openpower/sv/biginteger/divgnu64.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/openpower/sv/biginteger/divgnu64.c b/openpower/sv/biginteger/divgnu64.c index 6a94c66ca..483f099a5 100644 --- a/openpower/sv/biginteger/divgnu64.c +++ b/openpower/sv/biginteger/divgnu64.c @@ -56,6 +56,13 @@ void dumpit(char *msg, int n, unsigned v[]) printf("\n"); } +void bigrsh(unsigned s, unsigned r[], unsigned un[], int n) +{ + for (int i = 0; i < n - 1; i++) + r[i] = (un[i] >> s) | ((unsigned long long)un[i + 1] << (32 - s)); + r[n - 1] = un[n - 1] >> s; +} + bool bigmul(unsigned long long qhat, unsigned product[], unsigned vn[], int m, int n) { @@ -210,9 +217,7 @@ int divmnu(unsigned q[], unsigned r[], const unsigned u[], const unsigned v[], // it and pass it back. if (r != NULL) { - for (i = 0; i < n - 1; i++) - r[i] = (un[i] >> s) | ((unsigned long long)un[i + 1] << (32 - s)); - r[n - 1] = un[n - 1] >> s; + bigrsh(s, r, un, n); } return 0; } -- 2.30.2