diff options
| author | Eric Fiselier <eric@efcs.ca> | 2016-05-30 01:31:04 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2016-05-30 01:31:04 +0000 |
| commit | 9ef549212c2c952ef5314432b7230270466a62ca (patch) | |
| tree | 92305bb1ab4f19089d0f5ede4d1d8d4236bae2b6 /libcxx/test/support | |
| parent | f96bc6eb0c1708682eb51380c36ca627a27ca92e (diff) | |
| download | bcm5719-llvm-9ef549212c2c952ef5314432b7230270466a62ca.tar.gz bcm5719-llvm-9ef549212c2c952ef5314432b7230270466a62ca.zip | |
Fix bug in test allocator that incorrectly computed the allocation size
llvm-svn: 271195
Diffstat (limited to 'libcxx/test/support')
| -rw-r--r-- | libcxx/test/support/test_memory_resource.hpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libcxx/test/support/test_memory_resource.hpp b/libcxx/test/support/test_memory_resource.hpp index 88fb41d55ec..e7b067cf631 100644 --- a/libcxx/test/support/test_memory_resource.hpp +++ b/libcxx/test/support/test_memory_resource.hpp @@ -16,6 +16,7 @@ #include <cstddef> #include <cstdlib> #include <cstring> +#include <cstdint> #include <cassert> #include "test_macros.h" @@ -274,18 +275,18 @@ private: std::size_t bytes = (s + BlockSize - 1) & ~(BlockSize - 1); bytes += BlockSize; assert(bytes % BlockSize == 0); - return bytes / BlockSize; + return bytes; } static bool is_max_aligned(void* p) { - return reinterpret_cast<std::size_t>(p) % BlockSize == 0; + return reinterpret_cast<std::uintptr_t>(p) % BlockSize == 0; } static bool is_min_aligned(void* p) { if (alignof(T) == BlockSize) { return is_max_aligned(p); } else { - return reinterpret_cast<std::size_t>(p) % BlockSize == alignof(T); + return reinterpret_cast<std::uintptr_t>(p) % BlockSize == alignof(T); } } |

