37 static_assert(alignment_bytes == 0 || misalignment_bytes < alignment_bytes);
42 const size_t num_required_bytes =
43 misalignment_bytes + num_items *
sizeof(T);
45 const size_t num_allocated_bytes =
48 std::uintptr_t ptr =
reinterpret_cast<std::uintptr_t
>(
50 std::aligned_alloc(alignment_bytes, num_allocated_bytes));
52 _aligned_malloc(alignment_bytes, num_allocated_bytes));
54 return reinterpret_cast<T*
>(ptr + misalignment_bytes);