[libc-commits] [libc] [libc] Cache the most recently used slot for a chunk size (PR #149751)
Shilei Tian via libc-commits
libc-commits at lists.llvm.org
Wed Jul 23 10:32:09 PDT 2025
================
@@ -123,6 +112,16 @@ static inline uint32_t get_chunk_size(uint32_t x) {
return (s3 + MIN_ALIGNMENT) & ~MIN_ALIGNMENT;
}
+// Converts a chunk size into an index suitable for a statically sized array.
+static inline constexpr uint32_t get_chunk_id(uint32_t x) {
+ uint32_t y = x >> 4;
+ if (x <= MIN_SIZE)
+ return 0;
----------------
shiltian wrote:
```suggestion
if (x <= MIN_SIZE)
return 0;
uint32_t y = x >> 4;
```
https://github.com/llvm/llvm-project/pull/149751
More information about the libc-commits
mailing list