MCPcopy Create free account
hub / github.com/beefytech/Beef / aligned_usize_get

Function aligned_usize_get

BeefRT/JEMalloc/src/jemalloc.c:2294–2319  ·  view source on GitHub ↗

* ind parameter is optional and is only checked and filled if alignment == 0; * return true if result is out of range. */

Source from the content-addressed store, hash-verified

2292 * return true if result is out of range.
2293 */
2294JEMALLOC_ALWAYS_INLINE bool
2295aligned_usize_get(size_t size, size_t alignment, size_t *usize, szind_t *ind,
2296 bool bump_empty_aligned_alloc) {
2297 assert(usize != NULL);
2298 if (alignment == 0) {
2299 if (ind != NULL) {
2300 *ind = sz_size2index(size);
2301 if (unlikely(*ind >= SC_NSIZES)) {
2302 return true;
2303 }
2304 *usize = sz_index2size(*ind);
2305 assert(*usize > 0 && *usize <= SC_LARGE_MAXCLASS);
2306 return false;
2307 }
2308 *usize = sz_s2u(size);
2309 } else {
2310 if (bump_empty_aligned_alloc && unlikely(size == 0)) {
2311 size = 1;
2312 }
2313 *usize = sz_sa2u(size, alignment);
2314 }
2315 if (unlikely(*usize == 0 || *usize > SC_LARGE_MAXCLASS)) {
2316 return true;
2317 }
2318 return false;
2319}
2320
2321JEMALLOC_ALWAYS_INLINE bool
2322zero_get(bool guarantee, bool slow) {

Callers 5

imalloc_bodyFunction · 0.85
do_rallocxFunction · 0.85
ixallocx_profFunction · 0.85
inallocxFunction · 0.85
batch_allocFunction · 0.85

Calls 4

sz_size2indexFunction · 0.85
sz_index2sizeFunction · 0.85
sz_s2uFunction · 0.85
sz_sa2uFunction · 0.85

Tested by

no test coverage detected