Mask integer shift counts to six bits
Build / AerScript (push) Successful in 40s

This commit is contained in:
2026-10-29 19:36:40 +01:00
parent 2252d479a3
commit 54fd0cf7a6
+6 -6
View File
@@ -4652,7 +4652,7 @@ Resume:
} }
/* Perform the requested operation */ /* Perform the requested operation */
a = pNos->x.iVal; a = pNos->x.iVal;
b = (sxi32)pTos->x.iVal; b = (sxi32)((sxu64)pTos->x.iVal & 63);
if(pInstr->iOp == PH7_OP_SHL) { if(pInstr->iOp == PH7_OP_SHL) {
r = PH7_Int64FromUnsigned((sxu64)a << b); r = PH7_Int64FromUnsigned((sxu64)a << b);
} else { } else {
@@ -4667,15 +4667,15 @@ Resume:
/* OP_SHL_STORE * * * /* OP_SHL_STORE * * *
* *
* Pop the top two elements from the stack. Convert both elements * Pop the top two elements from the stack. Convert both elements
* to integers. Push back onto the stack the second element shifted * to integers. Push back onto the stack the top element shifted
* left by N bits where N is the top element on the stack. * left by N bits where N is the second element on the stack.
* Note: Only integer arithmetic is allowed. * Note: Only integer arithmetic is allowed.
*/ */
/* OP_SHR_STORE * * * /* OP_SHR_STORE * * *
* *
* Pop the top two elements from the stack. Convert both elements * Pop the top two elements from the stack. Convert both elements
* to integers. Push back onto the stack the second element shifted * to integers. Push back onto the stack the top element shifted
* right by N bits where N is the top element on the stack. * right by N bits where N is the second element on the stack.
* Note: Only integer arithmetic is allowed. * Note: Only integer arithmetic is allowed.
*/ */
case PH7_OP_SHL_STORE: case PH7_OP_SHL_STORE:
@@ -4696,7 +4696,7 @@ Resume:
} }
/* Perform the requested operation */ /* Perform the requested operation */
a = pTos->x.iVal; a = pTos->x.iVal;
b = (sxi32)pNos->x.iVal; b = (sxi32)((sxu64)pNos->x.iVal & 63);
if(pInstr->iOp == PH7_OP_SHL_STORE) { if(pInstr->iOp == PH7_OP_SHL_STORE) {
r = PH7_Int64FromUnsigned((sxu64)a << b); r = PH7_Int64FromUnsigned((sxu64)a << b);
} else { } else {