diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-07 00:46:26 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-07 00:46:26 -0400 |
| commit | ef23faa3e6e003282e53fc08031ec4eb9a2e2aae (patch) | |
| tree | 763944687f506e5dded02956ab3b45c456e16146 /src/typecheck.c | |
| parent | 3554c56b209a1544c69e189ddab3b19b4bf80ae6 (diff) | |
Add Byte.to() method and improved micro optimization of iterating over
fixed-width integer ranges
Diffstat (limited to 'src/typecheck.c')
| -rw-r--r-- | src/typecheck.c | 12 |
1 files changed, 6 insertions, 6 deletions
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?:` |
