Fix 0**0 with wide numbers (#4721).

This commit is contained in:
Wilson Snyder
2023-11-26 17:11:22 -05:00
parent a7a48221d3
commit a022b672a0
7 changed files with 780 additions and 67 deletions
+4 -1
View File
@@ -576,7 +576,10 @@ WDataOutP VL_POW_WWQ(int obits, int lbits, int rbits, WDataOutP owp, const WData
return VL_POW_WWW(obits, lbits, rbits, owp, lwp, rhsw);
}
QData VL_POW_QQW(int, int, int rbits, QData lhs, const WDataInP rwp) VL_MT_SAFE {
// Skip check for rhs == 0, as short-circuit doesn't save time
const int rwords = VL_WORDS_I(rbits);
EData rnz = rwp[0];
for (int w = 1; w < rwords; ++w) rnz |= rwp[w];
if (!rnz) return 1; // rwp == 0
if (VL_UNLIKELY(lhs == 0)) return 0;
QData power = lhs;
QData result = 1ULL;