From fc64d0b5818a18d5b68a8c23f78bc431f9ccb9bc Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Thu, 17 Oct 2024 01:49:19 -0400 Subject: [PATCH] More fixes --- tests/test_general.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_general.cpp b/tests/test_general.cpp index 0b9c07c..9abc6c1 100644 --- a/tests/test_general.cpp +++ b/tests/test_general.cpp @@ -27,16 +27,16 @@ constexpr std::size_t KiB = 1024U; constexpr std::size_t MiB = KiB * KiB; #ifdef _WIN32 -auto make_arena(size_t align, size_t size) -> std::shared_ptr +auto make_arena(std::align_val_t align, size_t size) -> std::shared_ptr { - return std::shared_ptr(static_cast(_aligned_malloc(size, align)), - &_aligned_free); + return std::shared_ptr( + static_cast(_aligned_malloc(size, static_cast(align))), &_aligned_free); } #else -auto make_arena(size_t align, size_t size) -> std::shared_ptr +auto make_arena(std::align_val_t align, size_t size) -> std::shared_ptr { - return std::shared_ptr(static_cast(std::aligned_alloc(align, size)), - &_aligned_free); + return std::shared_ptr( + static_cast(std::aligned_alloc(static_cast(align), size)), &_aligned_free); } #endif @@ -151,7 +151,7 @@ TEST_CASE("General: allocate: OOM") { constexpr auto MiB256 = MiB * 256U; constexpr auto ArenaSize = MiB256 + MiB; - const std::shared_ptr arena = make_arena(64U, ArenaSize); + const std::shared_ptr arena = make_arena(std::align_val_t(64U), ArenaSize); auto heap = init(arena.get(), ArenaSize); REQUIRE(heap != nullptr); @@ -192,7 +192,7 @@ TEST_CASE("General: allocate: smallest") using internal::Fragment; constexpr auto ArenaSize = MiB * 300U; - const std::shared_ptr arena = make_arena(64U, ArenaSize); + const std::shared_ptr arena = make_arena(std::align_val_t(64U), ArenaSize); auto heap = init(arena.get(), ArenaSize); REQUIRE(heap != nullptr); @@ -224,7 +224,7 @@ TEST_CASE("General: allocate: size_t overflow") constexpr auto size_max = std::numeric_limits::max(); constexpr auto ArenaSize = MiB * 300U; - const std::shared_ptr arena = make_arena(64U, ArenaSize); + const std::shared_ptr arena = make_arena(std::align_val_t(64U), ArenaSize); auto heap = init(arena.get(), ArenaSize); REQUIRE(heap != nullptr); @@ -496,7 +496,7 @@ TEST_CASE("General: random A") using internal::Fragment; constexpr auto ArenaSize = MiB * 300U; - const std::shared_ptr arena = make_arena(64U, ArenaSize); + const std::shared_ptr arena = make_arena(std::align_val_t(64U), ArenaSize); std::generate_n(arena.get(), ArenaSize, getRandomByte); // Random-fill the ENTIRE arena! auto heap = init(arena.get(), ArenaSize); REQUIRE(heap != nullptr);