| 1525 | static const unsigned TOP_LIMIT = 64512; // MEDIUM_BLOCK_LIMIT |
| 1526 | |
| 1527 | static unsigned getSlot(size_t size, GetSlotFor mode) |
| 1528 | { |
| 1529 | // add 2 asserts as long as we have not found better way to declare consts |
| 1530 | fb_assert(TOTAL_ELEMENTS == MEDIUM_SLOTS); |
| 1531 | fb_assert(TOP_LIMIT == *MEDIUM_BLOCK_LIMIT); |
| 1532 | |
| 1533 | const size_t LOW_LIMIT = 1032; |
| 1534 | fb_assert(size <= TOP_LIMIT); |
| 1535 | fb_assert(size >= LOW_LIMIT); |
| 1536 | fb_assert(MEM_ALIGN(size) == size); |
| 1537 | |
| 1538 | unsigned slot = mediumSlots[(size - LOW_LIMIT) >> 7]; |
| 1539 | fb_assert(size <= mediumLimits[slot]); |
| 1540 | if (mediumLimits[slot] > size && mode == SLOT_FREE) |
| 1541 | { |
| 1542 | if (!slot) |
| 1543 | return ~0; |
| 1544 | --slot; |
| 1545 | } |
| 1546 | |
| 1547 | return slot; |
| 1548 | } |
| 1549 | |
| 1550 | static unsigned getSize(unsigned slot) |
| 1551 | { |
nothing calls this directly
no test coverage detected