Fix 64-bit signed power with -1.

This commit is contained in:
Wilson Snyder 2019-12-03 06:26:17 -05:00
parent ac4f0da9ee
commit 2240f42bfa
1 changed files with 4 additions and 4 deletions

View File

@ -545,10 +545,10 @@ QData VL_POWSS_QQW(int obits, int, int rbits,
QData lhs, WDataInP rwp, bool lsign, bool rsign) VL_MT_SAFE {
// Skip check for rhs == 0, as short-circuit doesn't save time
if (rsign && VL_SIGN_W(rbits, rwp)) {
if (lhs==0) return 0; // "X"
else if (lhs==1) return 1;
else if (lsign && lhs==VL_MASK_I(obits)) { // -1
if (rwp[0] & 1) return VL_MASK_I(obits); // -1^odd=-1
if (lhs == 0) return 0; // "X"
else if (lhs == 1) return 1;
else if (lsign && lhs == VL_MASK_Q(obits)) { // -1
if (rwp[0] & 1) return VL_MASK_Q(obits); // -1^odd=-1
else return 1; // -1^even=1
}
return 0;