diff options
Diffstat (limited to 'pw_allocator/public/pw_allocator/freelist.h')
-rw-r--r-- | pw_allocator/public/pw_allocator/freelist.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pw_allocator/public/pw_allocator/freelist.h b/pw_allocator/public/pw_allocator/freelist.h index e10692aac..a5a50416e 100644 --- a/pw_allocator/public/pw_allocator/freelist.h +++ b/pw_allocator/public/pw_allocator/freelist.h @@ -14,9 +14,9 @@ #pragma once #include <array> -#include <span> #include "pw_containers/vector.h" +#include "pw_span/span.h" #include "pw_status/status.h" namespace pw::allocator { @@ -64,31 +64,31 @@ class FreeList { // OK: The chunk was added successfully // OUT_OF_RANGE: The chunk could not be added for size reasons (e.g. if // the chunk is too small to store the FreeListNode). - Status AddChunk(std::span<std::byte> chunk); + Status AddChunk(span<std::byte> chunk); // Finds an eligible chunk for an allocation of size `size`. Note that this // will return the first allocation possible within a given bucket, it does - // not currently optimize for finding the smallest chunk. Returns a std::span + // not currently optimize for finding the smallest chunk. Returns a span // representing the chunk. This will be "valid" on success, and will have size // = 0 on failure (if there were no chunks available for that allocation). - std::span<std::byte> FindChunk(size_t size) const; + span<std::byte> FindChunk(size_t size) const; // Remove a chunk from this freelist. Returns: // OK: The chunk was removed successfully // NOT_FOUND: The chunk could not be found in this freelist. - Status RemoveChunk(std::span<std::byte> chunk); + Status RemoveChunk(span<std::byte> chunk); private: // For a given size, find which index into chunks_ the node should be written // to. - size_t FindChunkPtrForSize(size_t size, bool non_null) const; + unsigned short FindChunkPtrForSize(size_t size, bool non_null) const; private: template <size_t kNumBuckets> friend class FreeListBuffer; struct FreeListNode { - // TODO: Double-link this? It'll make removal easier/quicker. + // TODO(jgarside): Double-link this? It'll make removal easier/quicker. FreeListNode* next; size_t size; }; |