MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / rpaligned_alloc

Function rpaligned_alloc

vm/ByteCodeTranslator/src/rpmalloc.c:1675–1691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1673}
1674
1675void*
1676rpaligned_alloc(size_t alignment, size_t size) {
1677 if (alignment <= 16)
1678 return rpmalloc(size);
1679
1680#if ENABLE_VALIDATE_ARGS
1681 if (size + alignment < size) {
1682 errno = EINVAL;
1683 return 0;
1684 }
1685#endif
1686
1687 void* ptr = rpmalloc(size + alignment);
1688 if ((uintptr_t)ptr & (alignment - 1))
1689 ptr = (void*)(((uintptr_t)ptr & ~((uintptr_t)alignment - 1)) + alignment);
1690 return ptr;
1691}
1692
1693void*
1694rpmemalign(size_t alignment, size_t size) {

Callers 3

aligned_allocFunction · 0.85
rpmemalignFunction · 0.85
rpposix_memalignFunction · 0.85

Calls 1

rpmallocFunction · 0.85

Tested by

no test coverage detected