Lines Matching defs:align
33 static bool is_aligned_to(void* ptr, size_t align) {
36 void* result = std::align(align, 1, p2, space);
42 void* do_allocate(size_t bytes, size_t align) override {
44 return std::__libcpp_allocate<std::byte>(__element_count(bytes), align);
48 std::byte* result = std::__libcpp_allocate<std::byte>(__element_count(bytes), align);
49 if (!is_aligned_to(result, align)) {
50 std::__libcpp_deallocate<std::byte>(result, __element_count(bytes), align);
57 void do_deallocate(void* p, size_t bytes, size_t align) override {
58 std::__libcpp_deallocate<std::byte>(static_cast<std::byte*>(p), __element_count(bytes), align);
160 void* unsynchronized_pool_resource::__adhoc_pool::__do_allocate(memory_resource* upstream, size_t bytes, size_t align) {
164 if (align < footer_align)
165 align = footer_align;
169 void* result = upstream->allocate(aligned_capacity, align);
174 h->__align_ = align;
180 memory_resource* upstream, void* p, size_t bytes, size_t align) {
282 int unsynchronized_pool_resource::__pool_index(size_t bytes, size_t align) const {
283 if (align > alignof(std::max_align_t) || bytes > (size_t(1) << __num_fixed_pools_))
287 bytes = (bytes > align) ? bytes : align;
345 void* unsynchronized_pool_resource::do_allocate(size_t bytes, size_t align) {
354 int i = __pool_index(bytes, align);
356 return __adhoc_pool_.__do_allocate(__res_, bytes, align);
399 void unsynchronized_pool_resource::do_deallocate(void* p, size_t bytes, size_t align) {
404 int i = __pool_index(bytes, align);
406 return __adhoc_pool_.__do_deallocate(__res_, p, bytes, align);
420 static void* align_down(size_t align, size_t size, void*& ptr, size_t& space) {
425 char* new_ptr = reinterpret_cast<char*>(reinterpret_cast<uintptr_t>(p1 - size) & ~(align - 1));
437 void* __try_allocate_from_chunk(Chunk& self, size_t bytes, size_t align) {
447 void* aligned_ptr = align_down(align, bytes, new_ptr, new_capacity);
453 void* monotonic_buffer_resource::do_allocate(size_t bytes, size_t align) {
466 if (void* result = __try_allocate_from_chunk<true, __initial_descriptor>(__initial_, bytes, align))
469 if (void* result = __try_allocate_from_chunk<false, __chunk_footer>(*__chunks_, bytes, align))
475 if (align < footer_align)
476 align = footer_align;
486 char* start = (char*)__res_->allocate(aligned_capacity, align);
492 footer->__align_ = align;
495 return __try_allocate_from_chunk<false, __chunk_footer>(*__chunks_, bytes, align);