]> Git Repo - qemu.git/commitdiff
disas: nanoMIPS: Fix types and format strings
authorStefan Weil <[email protected]>
Thu, 27 Dec 2018 16:56:04 +0000 (17:56 +0100)
committerAleksandar Markovic <[email protected]>
Thu, 3 Jan 2019 16:52:52 +0000 (17:52 +0100)
Use POSIX types and format strings.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
disas/nanomips.cpp
disas/nanomips.h

index 1238c2ff33c0e20d82ed780bb35c3f4635c29359..28d78d631a85138d1814462a32843f6284ae7174 100644 (file)
@@ -258,7 +258,7 @@ namespace img
 std::string to_string(img::address a)
 {
     char buffer[256];
-    sprintf(buffer, "0x%08llx", a);
+    sprintf(buffer, "0x%" PRIx64, a);
     return buffer;
 }
 
@@ -284,7 +284,8 @@ uint64 NMD::renumber_registers(uint64 index, uint64 *register_list,
     }
 
     throw std::runtime_error(img::format(
-                   "Invalid register mapping index %d, size of list = %d",
+                   "Invalid register mapping index %" PRIu64
+                   ", size of list = %zu",
                    index, register_list_size));
 }
 
@@ -501,7 +502,8 @@ std::string NMD::GPR(uint64 reg)
         return gpr_reg[reg];
     }
 
-    throw std::runtime_error(img::format("Invalid GPR register index %d", reg));
+    throw std::runtime_error(img::format("Invalid GPR register index %" PRIu64,
+                                         reg));
 }
 
 
@@ -518,7 +520,8 @@ std::string NMD::FPR(uint64 reg)
         return fpr_reg[reg];
     }
 
-    throw std::runtime_error(img::format("Invalid FPR register index %d", reg));
+    throw std::runtime_error(img::format("Invalid FPR register index %" PRIu64,
+                                         reg));
 }
 
 
@@ -532,26 +535,27 @@ std::string NMD::AC(uint64 reg)
         return ac_reg[reg];
     }
 
-    throw std::runtime_error(img::format("Invalid AC register index %d", reg));
+    throw std::runtime_error(img::format("Invalid AC register index %" PRIu64,
+                                         reg));
 }
 
 
 std::string NMD::IMMEDIATE(uint64 value)
 {
-    return img::format("0x%x", value);
+    return img::format("0x%" PRIx64, value);
 }
 
 
 std::string NMD::IMMEDIATE(int64 value)
 {
-    return img::format("%d", value);
+    return img::format("%" PRId64, value);
 }
 
 
 std::string NMD::CPR(uint64 reg)
 {
     /* needs more work */
-    return img::format("CP%d", reg);
+    return img::format("CP%" PRIu64, reg);
 }
 
 
index 84cc9a6dfcbfbbd1c443c58f25d5dd3a33762060..71428b3aba1d133bbc58d05ca5f5f82e7bde8bb6 100644 (file)
 
 #include <string>
 
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef long long int64;
-typedef unsigned long long uint64;
+typedef int64_t int64;
+typedef uint64_t uint64;
+typedef uint32_t uint32;
+typedef uint16_t uint16;
 
 namespace img
 {
-    typedef unsigned long long address;
+    typedef uint64_t address;
 }
 
 
This page took 0.049247 seconds and 4 git commands to generate.