Lines Matching refs:size

16  *   u: Usable size
20 * interpret function names. E.g. sz_psz2ind converts page size to page size
21 * index; sz_sa2u converts a (size, alignment) allocation request to the usable
22 * size that would result from such an allocation.
37 * size classes. In order to reduce cache footprint, the table is compressed,
121 sz_size2index_compute(size_t size) {
122 if (unlikely(size > SC_LARGE_MAXCLASS)) {
126 if (size == 0) {
130 if (size <= (ZU(1) << SC_LG_TINY_MAXCLASS)) {
132 szind_t lg_ceil = lg_floor(pow2_ceil_zu(size));
137 szind_t x = lg_floor((size<<1)-1);
146 szind_t mod = ((((size-1) & delta_inverse_mask) >> lg_delta)) &
155 sz_size2index_lookup(size_t size) {
156 assert(size <= SC_LOOKUP_MAXCLASS);
157 szind_t ret = (sz_size2index_tab[(size + (ZU(1) << SC_LG_TINY_MIN) - 1)
159 assert(ret == sz_size2index_compute(size));
164 sz_size2index(size_t size) {
165 if (likely(size <= SC_LOOKUP_MAXCLASS)) {
166 return sz_size2index_lookup(size);
168 return sz_size2index_compute(size);
211 sz_s2u_compute(size_t size) {
212 if (unlikely(size > SC_LARGE_MAXCLASS)) {
216 if (size == 0) {
217 size++;
220 if (size <= (ZU(1) << SC_LG_TINY_MAXCLASS)) {
222 size_t lg_ceil = lg_floor(pow2_ceil_zu(size));
228 size_t x = lg_floor((size<<1)-1);
233 size_t usize = (size + delta_mask) & ~delta_mask;
239 sz_s2u_lookup(size_t size) {
240 size_t ret = sz_index2size_lookup(sz_size2index_lookup(size));
242 assert(ret == sz_s2u_compute(size));
247 * Compute usable size that would result from allocating an object with the
248 * specified size.
251 sz_s2u(size_t size) {
252 if (likely(size <= SC_LOOKUP_MAXCLASS)) {
253 return sz_s2u_lookup(size);
255 return sz_s2u_compute(size);
259 * Compute usable size that would result from allocating an object with the
260 * specified size and alignment.
263 sz_sa2u(size_t size, size_t alignment) {
268 /* Try for a small size class. */
269 if (size <= SC_SMALL_MAXCLASS && alignment < PAGE) {
271 * Round size up to the nearest multiple of alignment.
274 * small size class, every object is aligned at the smallest
276 * of the size. For example:
284 usize = sz_s2u(ALIGNMENT_CEILING(size, alignment));
290 /* Large size class. Beware of overflow. */
296 /* Make sure result is a large size class. */
297 if (size <= SC_LARGE_MINCLASS) {
300 usize = sz_s2u(size);
301 if (usize < size) {