From 566706dd625aebe186039bda5f21ae4b6afcf022 Mon Sep 17 00:00:00 2001 From: joevt Date: Fri, 1 Dec 2023 18:05:56 -0800 Subject: [PATCH] ppctests: Fix compiler warnings. --- cpu/ppc/test/ppctests.cpp | 18 +++++++++--------- cpu/ppc/test/testdisasm.cpp | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cpu/ppc/test/ppctests.cpp b/cpu/ppc/test/ppctests.cpp index 20fccf3..b22067a 100644 --- a/cpu/ppc/test/ppctests.cpp +++ b/cpu/ppc/test/ppctests.cpp @@ -113,7 +113,7 @@ static void read_test_data() { continue; } - opcode = stoul(tokens[1], NULL, 16); + opcode = (uint32_t)stoul(tokens[1], NULL, 16); dest = 0; src1 = 0; @@ -123,15 +123,15 @@ static void read_test_data() { for (i = 2; i < tokens.size(); i++) { if (tokens[i].rfind("rD=", 0) == 0) { - dest = stoul(tokens[i].substr(3), NULL, 16); + dest = (uint32_t)stoul(tokens[i].substr(3), NULL, 16); } else if (tokens[i].rfind("rA=", 0) == 0) { - src1 = stoul(tokens[i].substr(3), NULL, 16); + src1 = (uint32_t)stoul(tokens[i].substr(3), NULL, 16); } else if (tokens[i].rfind("rB=", 0) == 0) { - src2 = stoul(tokens[i].substr(3), NULL, 16); + src2 = (uint32_t)stoul(tokens[i].substr(3), NULL, 16); } else if (tokens[i].rfind("XER=", 0) == 0) { - check_xer = stoul(tokens[i].substr(4), NULL, 16); + check_xer = (uint32_t)stoul(tokens[i].substr(4), NULL, 16); } else if (tokens[i].rfind("CR=", 0) == 0) { - check_cr = stoul(tokens[i].substr(3), NULL, 16); + check_cr = (uint32_t)stoul(tokens[i].substr(3), NULL, 16); } else { cout << "Unknown parameter " << tokens[i] << " in line " << lineno << ". Exiting..." << endl; @@ -227,7 +227,7 @@ static void read_test_float_data() { continue; } - opcode = stoul(tokens[1], NULL, 16); + opcode = (uint32_t)stoul(tokens[1], NULL, 16); src1 = 0; src2 = 0; @@ -253,9 +253,9 @@ static void read_test_float_data() { } else if (tokens[i].rfind("round=", 0) == 0) { rounding_mode = tokens[i].substr(6, 3); } else if (tokens[i].rfind("FPSCR=", 0) == 0) { - check_fpscr = stoul(tokens[i].substr(6), NULL, 16); + check_fpscr = (uint32_t)stoul(tokens[i].substr(6), NULL, 16); } else if (tokens[i].rfind("CR=", 0) == 0) { - check_cr = stoul(tokens[i].substr(3), NULL, 16); + check_cr = (uint32_t)stoul(tokens[i].substr(3), NULL, 16); } else { cout << "Unknown parameter " << tokens[i] << " in line " << lineno << ". Exiting..." << endl; diff --git a/cpu/ppc/test/testdisasm.cpp b/cpu/ppc/test/testdisasm.cpp index b328f4a..8d1edd0 100644 --- a/cpu/ppc/test/testdisasm.cpp +++ b/cpu/ppc/test/testdisasm.cpp @@ -65,15 +65,15 @@ static vector read_test_data() { } ctx = {0}; - ctx.instr_addr = stoul(tokens[0], NULL, 16); - ctx.instr_code = stoul(tokens[1], NULL, 16); + ctx.instr_addr = (uint32_t)stoul(tokens[0], NULL, 16); + ctx.instr_code = (uint32_t)stoul(tokens[1], NULL, 16); /* build disassembly string out of comma-separated parts */ ostringstream idisasm; /* put instruction mnemonic padded with trailing spaces */ idisasm << tokens[2]; - idisasm << setw(8 - tokens[2].length()) << " "; + idisasm << setw(8 - (int)tokens[2].length()) << " "; /* now add comma-separated operands */ for (i = 3; i < tokens.size(); i++) {