aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorBarinzaya <barinzaya@gmail.com>2025-03-02 13:29:39 -0500
committerBarinzaya <barinzaya@gmail.com>2025-03-02 13:29:39 -0500
commit6e3d17d189a5f86383505daaaa742acf6d647ba1 (patch)
tree5f074811940bf915059de1d87851561cb8b513da /src/check_expr.cpp
parent94152ca701929d877d0ca94f922ba29fbafd46f3 (diff)
Fixed `~` on `bit_set[Some_Enum]` altering the definition of the enum.
This was occurring for enums whose minimum values were greater than zero.
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index bd1c34044..2f7b5fd0a 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -2599,9 +2599,8 @@ gb_internal ExactValue exact_bit_set_all_set_mask(Type *type) {
continue;
}
- BigInt shift_amount = f->Constant.value.value_integer;
- big_int_sub_eq(&shift_amount, &b_lower_base);
-
+ BigInt shift_amount = {};
+ big_int_sub(&shift_amount, &f->Constant.value.value_integer, &b_lower_base);
BigInt value = {};
big_int_shl(&value, &one, &shift_amount);