[libc-commits] [libc] [libc][stdlib] Make the FreeListHeap constant-initializable (PR #95453)
via libc-commits
libc-commits at lists.llvm.org
Fri Jun 14 12:06:22 PDT 2024
================
@@ -69,36 +69,44 @@ template <size_t NUM_BUCKETS = 6> class FreeList {
/// Removes a chunk from this freelist.
bool remove_chunk(cpp::span<cpp::byte> chunk);
-private:
- // For a given size, find which index into chunks_ the node should be written
- // to.
- size_t find_chunk_ptr_for_size(size_t size, bool non_null) const;
+ /// For a given size, find which index into chunks_ the node should be written
+ /// to.
+ constexpr size_t find_chunk_ptr_for_size(size_t size, bool non_null) const;
struct FreeListNode {
FreeListNode *next;
size_t size;
};
-public:
- explicit FreeList(cpp::array<size_t, NUM_BUCKETS> sizes)
+ constexpr void set_freelist_node(FreeListNode *node,
+ cpp::span<cpp::byte> chunk);
+
+ constexpr explicit FreeList(cpp::array<size_t, NUM_BUCKETS> sizes)
----------------
PiJoules wrote:
Done. Needed to teach FixedVector about array's const_iterator
https://github.com/llvm/llvm-project/pull/95453
More information about the libc-commits
mailing list