From ef23faa3e6e003282e53fc08031ec4eb9a2e2aae Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 7 Apr 2025 00:46:26 -0400 Subject: Add Byte.to() method and improved micro optimization of iterating over fixed-width integer ranges --- src/typecheck.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/typecheck.c') diff --git a/src/typecheck.c b/src/typecheck.c index ce8b4276..fedc7c96 100644 --- a/src/typecheck.c +++ b/src/typecheck.c @@ -1056,9 +1056,9 @@ type_t *get_type(env_t *env, ast_t *ast) type_t *lhs_t = get_type(env, binop.lhs); type_t *rhs_t = get_type(env, binop.rhs); - if (binop.lhs->tag == Int && (is_int_type(rhs_t) || rhs_t->tag == ByteType)) + if (binop.lhs->tag == Int && is_int_type(rhs_t)) return rhs_t; - else if (binop.rhs->tag == Int && (is_int_type(lhs_t) || lhs_t->tag == ByteType)) + else if (binop.rhs->tag == Int && is_int_type(lhs_t)) return lhs_t; // `opt? or (x == y)` / `(x == y) or opt?` is a boolean conditional: @@ -1102,9 +1102,9 @@ type_t *get_type(env_t *env, ast_t *ast) type_t *lhs_t = get_type(env, binop.lhs); type_t *rhs_t = get_type(env, binop.rhs); - if (binop.lhs->tag == Int && (is_int_type(rhs_t) || rhs_t->tag == ByteType)) + if (binop.lhs->tag == Int && is_int_type(rhs_t)) return rhs_t; - else if (binop.rhs->tag == Int && (is_int_type(lhs_t) || lhs_t->tag == ByteType)) + else if (binop.rhs->tag == Int && is_int_type(lhs_t)) return lhs_t; // `and` between optionals/bools is a boolean expression like `if opt? and opt?:` or `if x > 0 and opt?:` @@ -1136,9 +1136,9 @@ type_t *get_type(env_t *env, ast_t *ast) type_t *lhs_t = get_type(env, binop.lhs); type_t *rhs_t = get_type(env, binop.rhs); - if (binop.lhs->tag == Int && (is_int_type(rhs_t) || rhs_t->tag == ByteType)) + if (binop.lhs->tag == Int && is_int_type(rhs_t)) return rhs_t; - else if (binop.rhs->tag == Int && (is_int_type(lhs_t) || lhs_t->tag == ByteType)) + else if (binop.rhs->tag == Int && is_int_type(lhs_t)) return lhs_t; // `xor` between optionals/bools is a boolean expression like `if opt? xor opt?:` or `if x > 0 xor opt?:` -- cgit v1.2.3