mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 14:20:17 +00:00
[test][libc] Fix aligned_alloc argument
Size must be multiple of Alignment. Reviewed By: gchatelet Differential Revision: https://reviews.llvm.org/D157247
This commit is contained in:
parent
3bcfd6e962
commit
9abc1e080d
@ -17,6 +17,7 @@
|
||||
#include "MemorySizeDistributions.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Support/Alignment.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <random>
|
||||
@ -107,11 +108,11 @@ class AlignedBuffer {
|
||||
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, alignTo(Size, Alignment)))),
|
||||
Size(Size) {}
|
||||
~AlignedBuffer() { free(Buffer); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user