From a5af8f3b0b7a394713d3a655cdb7d8a7415f26d7 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 23 Jul 2023 13:04:17 +0900 Subject: [PATCH] internal/shaderir: remove isUntypedInteger Updates #2550 --- internal/shader/expr.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/internal/shader/expr.go b/internal/shader/expr.go index 939064eb8..9362e3579 100644 --- a/internal/shader/expr.go +++ b/internal/shader/expr.go @@ -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