From 6e3d17d189a5f86383505daaaa742acf6d647ba1 Mon Sep 17 00:00:00 2001 From: Barinzaya Date: Sun, 2 Mar 2025 13:29:39 -0500 Subject: Fixed `~` on `bit_set[Some_Enum]` altering the definition of the enum. This was occurring for enums whose minimum values were greater than zero. --- src/check_expr.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/check_expr.cpp') 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); -- cgit v1.2.3