Skip to content

Commit

Permalink
slice: use card in bitset_to_enum_slice_with_make
Browse files Browse the repository at this point in the history
Fixes #4870
  • Loading branch information
laytan committed Feb 24, 2025
1 parent faaa055 commit 22ab893
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions core/slice/slice.odin
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 22ab893

Please sign in to comment.