From 22ab8935c414adf04d08d50e86867b7df141ef2c Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Mon, 24 Feb 2025 21:09:06 +0100 Subject: [PATCH] slice: use `card` in `bitset_to_enum_slice_with_make` Fixes #4870 --- core/slice/slice.odin | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/slice/slice.odin b/core/slice/slice.odin index 66166bddb81..c328fd2679c 100644 --- a/core/slice/slice.odin +++ b/core/slice/slice.odin @@ -898,8 +898,7 @@ bitset_to_enum_slice_with_buffer :: proc(buf: []$E, bs: $T) -> (slice: []E) wher // sl := slice.bitset_to_enum_slice(bs) @(require_results) bitset_to_enum_slice_with_make :: proc(bs: $T, $E: typeid, allocator := context.allocator) -> (slice: []E) where intrinsics.type_is_enum(E), intrinsics.type_bit_set_elem_type(T) == E { - ones := intrinsics.count_ones(transmute(E)bs) - buf := make([]E, int(ones), allocator) + buf := make([]E, card(bs), allocator) return bitset_to_enum_slice(buf, bs) }