diff --git a/tests/src/assembler_rv32i_tests.cpp b/tests/src/assembler_rv32i_tests.cpp index a3dec81..fa2b858 100644 --- a/tests/src/assembler_rv32i_tests.cpp +++ b/tests/src/assembler_rv32i_tests.cpp @@ -347,7 +347,7 @@ TEST_CASE("LI", "[rv32i]") { as.RewindBuffer(); vals = {}; - as.LI(x1, -1); + as.LI(x1, uint64_t(-1)); // addi x1, x0, -1 compare_vals(0xFFF00093, 0x00000000); as.RewindBuffer(); @@ -373,13 +373,13 @@ TEST_CASE("LI", "[rv32i]") { as.RewindBuffer(); vals = {}; - as.LI(x1, ~0xFFF); + as.LI(x1, ~0xFFFULL); // lui x1, -1 compare_vals(0xFFFFF0B7, 0x00000000); as.RewindBuffer(); vals = {}; - as.LI(x1, INT32_MIN); + as.LI(x1, uint64_t(INT32_MIN)); // lui x1, -524288 compare_vals(0x800000B7, 0x00000000); as.RewindBuffer(); diff --git a/tests/src/assembler_rv64i_tests.cpp b/tests/src/assembler_rv64i_tests.cpp index e019873..cfc3925 100644 --- a/tests/src/assembler_rv64i_tests.cpp +++ b/tests/src/assembler_rv64i_tests.cpp @@ -81,11 +81,12 @@ TEST_CASE("LD", "[rv64i]") { TEST_CASE("LI (RV64)", "[rv64i]") { // Up to 8 instructions can be generated - std::array vals{}; + constexpr size_t MAX_INSTS = 8; + std::array vals{}; auto as = MakeAssembler64(vals); const auto compare_vals = [&vals](const Args&... args) { - static_assert(sizeof...(args) <= vals.size()); + static_assert(sizeof...(args) <= MAX_INSTS); size_t i = 0; for (const auto arg : {args...}) { @@ -102,7 +103,7 @@ TEST_CASE("LI (RV64)", "[rv64i]") { as.RewindBuffer(); vals = {}; - as.LI(x1, -1); + as.LI(x1, uint64_t(-1)); // addiw x1, x0, -1 compare_vals(0xFFF0009BU, 0x00000000U); as.RewindBuffer(); @@ -128,13 +129,13 @@ TEST_CASE("LI (RV64)", "[rv64i]") { as.RewindBuffer(); vals = {}; - as.LI(x1, ~0xFFF); + as.LI(x1, ~0xFFFULL); // lui x1, -1 compare_vals(0xFFFFF0B7U, 0x00000000U); as.RewindBuffer(); vals = {}; - as.LI(x1, INT32_MIN); + as.LI(x1, uint64_t(INT32_MIN)); // lui x1, -524288 compare_vals(0x800000B7U, 0x00000000U); as.RewindBuffer();