Find the tier index for a given value size. Returns the index of the smallest tier that can hold `size` bytes.
(size: usize)
| 336 | /// |
| 337 | /// Returns the index of the smallest tier that can hold `size` bytes. |
| 338 | fn tier_index(size: usize) -> usize { |
| 339 | for (i, &tier_size) in TIER_SIZES.iter().enumerate() { |
| 340 | if size <= tier_size { |
| 341 | return i; |
| 342 | } |
| 343 | } |
| 344 | // Should not reach here for sizes <= MAX_SLAB_SIZE. |
| 345 | TIER_SIZES.len() - 1 |
| 346 | } |
| 347 | |
| 348 | #[cfg(test)] |
| 349 | mod tests { |