[libc-commits] [PATCH] D157247: [test][libc] Fix aligned_alloc argument
Vitaly Buka via Phabricator via libc-commits
libc-commits at lists.llvm.org
Sun Aug 6 18:19:06 PDT 2023
vitalybuka created this revision.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
vitalybuka requested review of this revision.
Size must be multiple of Alignment.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D157247
Files:
libc/benchmarks/LibcMemoryBenchmark.h
Index: libc/benchmarks/LibcMemoryBenchmark.h
===================================================================
--- libc/benchmarks/LibcMemoryBenchmark.h
+++ libc/benchmarks/LibcMemoryBenchmark.h
@@ -107,11 +107,11 @@
size_t Size = 0;
public:
- // Note: msan / asan can't handle Alignment > 512.
static constexpr size_t Alignment = 512;
explicit AlignedBuffer(size_t Size)
- : Buffer(static_cast<char *>(aligned_alloc(Alignment, Size))),
+ : Buffer(static_cast<char *>(aligned_alloc(
+ Alignment, (Size + Alignment - 1) / Alignment * Alignment))),
Size(Size) {}
~AlignedBuffer() { free(Buffer); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157247.547621.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230807/c9b0b13e/attachment.bin>
More information about the libc-commits
mailing list