#include "pls/internal/base/alignment.h" #include "pls/internal/base/system_details.h" namespace pls { namespace internal { namespace base { namespace alignment { void* allocate_aligned(size_t size) { return aligned_alloc(system_details::CACHE_LINE_SIZE, size); } std::uintptr_t next_alignment(std::uintptr_t size) { std::uintptr_t miss_alignment = size % base::system_details::CACHE_LINE_SIZE; if (miss_alignment == 0) { return size; } else { return size + (base::system_details::CACHE_LINE_SIZE - miss_alignment); } } char* next_alignment(char* pointer) { return reinterpret_cast<char*>(next_alignment(reinterpret_cast<std::uintptr_t >(pointer))); } } } } }