mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
parent
8b4c744ca8
commit
a5af8f3b0b
@ -34,21 +34,17 @@ func canTruncateToFloat(v gconstant.Value) bool {
|
||||
return gconstant.ToFloat(v).Kind() != gconstant.Unknown
|
||||
}
|
||||
|
||||
func isUntypedInteger(expr *shaderir.Expr) bool {
|
||||
return expr.Const.Kind() == gconstant.Int && expr.ConstType == shaderir.ConstTypeNone
|
||||
}
|
||||
|
||||
func isModAvailableForConsts(lhs, rhs *shaderir.Expr) bool {
|
||||
// % is available only when
|
||||
// 1) both are untyped integers
|
||||
// 1) both are untyped (constant) integers
|
||||
// 2) either is an typed integer and the other is truncatable to an integer
|
||||
if isUntypedInteger(lhs) && isUntypedInteger(rhs) {
|
||||
if lhs.Const.Kind() == gconstant.Int && rhs.Const.Kind() == gconstant.Int {
|
||||
return true
|
||||
}
|
||||
if lhs.ConstType == shaderir.ConstTypeInt && canTruncateToInteger(rhs.Const) {
|
||||
if lhs.Const.Kind() == gconstant.Int && canTruncateToInteger(rhs.Const) {
|
||||
return true
|
||||
}
|
||||
if rhs.ConstType == shaderir.ConstTypeInt && canTruncateToInteger(lhs.Const) {
|
||||
if rhs.Const.Kind() == gconstant.Int && canTruncateToInteger(lhs.Const) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user