Add allocator param.

This commit is contained in:
Jeroen van Rijn
2024-05-09 17:58:48 +02:00
parent e5af98eabe
commit 8f706a14f8

View File

@@ -730,9 +730,9 @@ bitset_to_enum_slice_with_buffer :: proc(buf: []$E, bs: $T) -> (slice: []E) wher
// e.g.:
// sl := slice.bitset_to_enum_slice(bs)
@(require_results)
bitset_to_enum_slice_with_make :: proc(bs: $T, $E: typeid) -> (slice: []E) where intrinsics.type_is_enum(E), intrinsics.type_bit_set_elem_type(T) == E {
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))
buf := make([]E, int(ones), allocator)
return bitset_to_enum_slice(buf, bs)
}