mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-23 08:20:10 +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
|
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 {
|
if lhst.Main == Int && rhst.Main == Int {
|
||||||
return Type{Main: Int}, true
|
return Type{Main: Int}, true
|
||||||
}
|
}
|
||||||
@ -190,7 +190,9 @@ func TypeFromBinaryOp(op Op, lhst, rhst Type, lhsConst, rhsConst constant.Value)
|
|||||||
return lhst, true
|
return lhst, true
|
||||||
}
|
}
|
||||||
if lhst.Main == Int && rhst.IsIntVector() {
|
if lhst.Main == Int && rhst.IsIntVector() {
|
||||||
return rhst, true
|
if op == And || op == Or || op == Xor {
|
||||||
|
return rhst, true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Type{}, false
|
return Type{}, false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user