mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-23 00:10:11 +01:00
add typechecks for bitshifts ops
This commit is contained in:
parent
cc3db584f2
commit
fe887e2565
@ -173,7 +173,7 @@ func TypeFromBinaryOp(op Op, lhst, rhst Type, lhsConst, rhsConst constant.Value)
|
||||
return Type{}, false
|
||||
}
|
||||
|
||||
if op == And || op == Or || op == Xor {
|
||||
if op == And || op == Or || op == Xor || op == LeftShift || op == RightShift {
|
||||
if lhst.Main == Int && rhst.Main == Int {
|
||||
return Type{Main: Int}, true
|
||||
}
|
||||
@ -190,8 +190,10 @@ func TypeFromBinaryOp(op Op, lhst, rhst Type, lhsConst, rhsConst constant.Value)
|
||||
return lhst, true
|
||||
}
|
||||
if lhst.Main == Int && rhst.IsIntVector() {
|
||||
if op == And || op == Or || op == Xor {
|
||||
return rhst, true
|
||||
}
|
||||
}
|
||||
return Type{}, false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user