Skip to content

Commit

Permalink
Fix incorrect signed check
Browse files Browse the repository at this point in the history
  • Loading branch information
rihi committed Nov 8, 2023
1 parent 4b3a654 commit 7a02198
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ def _constant_fold_shift(constants: list[Constant], fun: Callable[[int, int], in
raise IncompatibleOperandCount("Expected exactly 2 constants to fold")

left, right = constants
operand_signed = isinstance(left.type, Integer) and left.type.signed

return fun(normalize_int(left.value, left.type.size, left.type.signed and signed), right.value)
return fun(normalize_int(left.value, left.type.size, operand_signed and signed), right.value)


_OPERATION_TO_FOLD_FUNCTION: dict[OperationType, Callable[[list[Constant]], int]] = {
Expand Down

0 comments on commit 7a02198

Please sign in to comment.