diff options
author | 2017-08-10 09:59:20 +1000 | |
---|---|---|
committer | 2017-08-10 10:07:31 +1000 | |
commit | bc4bfb40051f912b8afe78bc99ab98383b2e7c15 (patch) | |
tree | 2a8cc876c501c78bb3ddccd6f67206d8c9590bee /src/devices | |
parent | 147f1d89b0a42ddd33c4f89abaed2765bc86dd8f (diff) |
Remove a whole lot of I64 from format strings.
There are a couple of issues here:
* Firstly, the determining factor for whether I64 or ll is needed as the
size qualifier doesn't depend entirely on whether you're using MSVC or
not, it depends on the the C runtime library. The msys64 C runtime
apes the Microsoft runtime and requires I64 as well, so a lot of files
where LLFORMAT had been copy/pasted wouldn't work right if you
depeneded on it anyway.
* Secondly, one of the major benefits of util::string_format,
util::stream_format and logerror in their current forms is that you
don't need size specifiers for integers at all (unless you're using
them to truncate a value, but in that case you're better off casting
the argument for clarity). If you do use them, logerror and friends
will accept both Microsoft- and SUS-style independently of the C
runtime.
So please everyone, don't go gratuitously throwing these around, and if
you must use them (e.g. for osd_printf_* functions), make sure your
conditionals are actually correct. Also, conisder using
util::string_format to do the formatting into a temporary string and
just feeding that to the output function so you can avoid the mess.
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/cpu/es5510/es5510.cpp | 22 | ||||
-rw-r--r-- | src/devices/machine/68340sim.cpp | 2 | ||||
-rw-r--r-- | src/devices/machine/68561mpcc.cpp | 2 | ||||
-rw-r--r-- | src/devices/machine/mc14411.cpp | 2 | ||||
-rw-r--r-- | src/devices/machine/nvram.cpp | 2 | ||||
-rw-r--r-- | src/devices/machine/z80sio.cpp | 2 | ||||
-rw-r--r-- | src/devices/sound/disc_sys.hxx | 2 | ||||
-rw-r--r-- | src/devices/video/sda5708.cpp | 2 |
8 files changed, 13 insertions, 23 deletions
diff --git a/src/devices/cpu/es5510/es5510.cpp b/src/devices/cpu/es5510/es5510.cpp index f8e81e4aeef..5848ccc05e2 100644 --- a/src/devices/cpu/es5510/es5510.cpp +++ b/src/devices/cpu/es5510/es5510.cpp @@ -421,12 +421,12 @@ WRITE8_MEMBER(es5510_device::host_w) break; /* 0x03 to 0x08 INSTR Register */ - case 0x03: instr_latch = ((instr_latch&0x00ffffffffffU) | (int64_t(data)&0xff)<<40); LOG("%s",string_format("ES5510: Host Write INSTR latch[5] = %02x -> %012I64x\n", data, instr_latch).c_str()); break; - case 0x04: instr_latch = ((instr_latch&0xff00ffffffffU) | (int64_t(data)&0xff)<<32); LOG("%s",string_format("ES5510: Host Write INSTR latch[4] = %02x -> %012I64x\n", data, instr_latch).c_str()); break; - case 0x05: instr_latch = ((instr_latch&0xffff00ffffffU) | (int64_t(data)&0xff)<<24); LOG("%s",string_format("ES5510: Host Write INSTR latch[3] = %02x -> %012I64x\n", data, instr_latch).c_str()); break; - case 0x06: instr_latch = ((instr_latch&0xffffff00ffffU) | (int64_t(data)&0xff)<<16); LOG("%s",string_format("ES5510: Host Write INSTR latch[2] = %02x -> %012I64x\n", data, instr_latch).c_str()); break; - case 0x07: instr_latch = ((instr_latch&0xffffffff00ffU) | (int64_t(data)&0xff)<< 8); LOG("%s",string_format("ES5510: Host Write INSTR latch[1] = %02x -> %012I64x\n", data, instr_latch).c_str()); break; - case 0x08: instr_latch = ((instr_latch&0xffffffffff00U) | (int64_t(data)&0xff)<< 0); LOG("%s",string_format("ES5510: Host Write INSTR latch[0] = %02x -> %012I64x\n", data, instr_latch).c_str()); break; + case 0x03: instr_latch = ((instr_latch&0x00ffffffffffU) | (int64_t(data)&0xff)<<40); LOG("%s",string_format("ES5510: Host Write INSTR latch[5] = %02x -> %012x\n", data, instr_latch).c_str()); break; + case 0x04: instr_latch = ((instr_latch&0xff00ffffffffU) | (int64_t(data)&0xff)<<32); LOG("%s",string_format("ES5510: Host Write INSTR latch[4] = %02x -> %012x\n", data, instr_latch).c_str()); break; + case 0x05: instr_latch = ((instr_latch&0xffff00ffffffU) | (int64_t(data)&0xff)<<24); LOG("%s",string_format("ES5510: Host Write INSTR latch[3] = %02x -> %012x\n", data, instr_latch).c_str()); break; + case 0x06: instr_latch = ((instr_latch&0xffffff00ffffU) | (int64_t(data)&0xff)<<16); LOG("%s",string_format("ES5510: Host Write INSTR latch[2] = %02x -> %012x\n", data, instr_latch).c_str()); break; + case 0x07: instr_latch = ((instr_latch&0xffffffff00ffU) | (int64_t(data)&0xff)<< 8); LOG("%s",string_format("ES5510: Host Write INSTR latch[1] = %02x -> %012x\n", data, instr_latch).c_str()); break; + case 0x08: instr_latch = ((instr_latch&0xffffffffff00U) | (int64_t(data)&0xff)<< 0); LOG("%s",string_format("ES5510: Host Write INSTR latch[0] = %02x -> %012x\n", data, instr_latch).c_str()); break; /* 0x09 to 0x0b DIL Register (r/o) */ @@ -476,7 +476,7 @@ WRITE8_MEMBER(es5510_device::host_w) break; case 0x80: /* Read select - GPR + INSTR */ - LOG("%s",string_format("ES5510: Host Read INSTR+GPR %02x (%s): %012I64x %06x (%d)\n", data, REGNAME(data & 0xff), instr[data] & 0xffffffffffffU, gpr[data] & 0xffffff, gpr[data]).c_str()); + LOG("%s",string_format("ES5510: Host Read INSTR+GPR %02x (%s): %012x %06x (%d)\n", data, REGNAME(data & 0xff), instr[data] & 0xffffffffffffU, gpr[data] & 0xffffff, gpr[data]).c_str()); /* Check if an INSTR address is selected */ if (data < 0xa0) { @@ -497,7 +497,7 @@ WRITE8_MEMBER(es5510_device::host_w) case 0xc0: /* Write select - INSTR */ #if VERBOSE DESCRIBE_INSTR(buf, instr_latch, gpr[data], nullptr, nullptr, nullptr, nullptr); - LOG("%s",string_format("ES5510: Host Write INSTR %02x %012I64x: %s\n", data, instr_latch&0xffffffffffffU, buf).c_str()); + LOG("%s",string_format("ES5510: Host Write INSTR %02x %012x: %s\n", data, instr_latch&0xffffffffffffU, buf).c_str()); #endif if (data < 0xa0) { instr[data] = instr_latch&0xffffffffffffU; @@ -507,7 +507,7 @@ WRITE8_MEMBER(es5510_device::host_w) case 0xe0: /* Write select - GPR + INSTR */ #if VERBOSE DESCRIBE_INSTR(buf, instr_latch, gpr_latch, nullptr, nullptr, nullptr, nullptr); - LOG("%s",string_format("ES5510: Host Write INSTR+GPR %02x (%s): %012I64x %06x (%d): %s\n", data, REGNAME(data&0xff), instr_latch, gpr_latch, SX(gpr_latch), buf).c_str()); + LOG("%s",string_format("ES5510: Host Write INSTR+GPR %02x (%s): %012x %06x (%d): %s\n", data, REGNAME(data&0xff), instr_latch, gpr_latch, SX(gpr_latch), buf).c_str()); #endif if (data < 0xa0) { instr[data] = instr_latch; @@ -677,7 +677,7 @@ void es5510_device::list_program(void(p)(const char *, ...)) { uint8_t cReg = (uint8_t)((instr[addr] >> 32) & 0xff); uint8_t dReg = (uint8_t)((instr[addr] >> 40) & 0xff); DESCRIBE_INSTR(buf, instr[addr], gpr[addr], name[aReg], name[bReg], name[cReg], name[dReg]); - p("%s",string_format("%02x: %012I64x %06x (%8d) %s\n", addr, instr[addr], gpr[addr]&0xffffff, SX(gpr[addr]&0xffffff), buf).c_str()); + p("%s",string_format("%02x: %012x %06x (%8d) %s\n", addr, instr[addr], gpr[addr]&0xffffff, SX(gpr[addr]&0xffffff), buf).c_str()); } for (; addr < 0xc0; addr++) { p("%02x: %06x (%d)\n", addr, gpr[addr]&0xffffff, SX(gpr[addr]&0xffffff)); @@ -703,7 +703,7 @@ void es5510_device::execute_run() { #if VERBOSE_EXEC char buf[1024]; DESCRIBE_INSTR(buf, instr[pc], gpr[pc], nullptr, nullptr, nullptr, nullptr); - LOG_EXEC(("%s",string_format("EXECUTING %02x: %012I64x %06x %s\n", pc, instr[pc], gpr[pc]&0xffffff, buf).c_str())); + LOG_EXEC(("%s",string_format("EXECUTING %02x: %012x %06x %s\n", pc, instr[pc], gpr[pc]&0xffffff, buf).c_str())); #endif ram_pp = ram_p; diff --git a/src/devices/machine/68340sim.cpp b/src/devices/machine/68340sim.cpp index 65090696444..34ce985cc22 100644 --- a/src/devices/machine/68340sim.cpp +++ b/src/devices/machine/68340sim.cpp @@ -26,10 +26,8 @@ #ifdef _MSC_VER #define FUNCNAME __func__ -#define LLFORMAT "%I64d" #else #define FUNCNAME __PRETTY_FUNCTION__ -#define LLFORMAT "%lld" #endif #define m68340SIM_MCR (0x00) diff --git a/src/devices/machine/68561mpcc.cpp b/src/devices/machine/68561mpcc.cpp index 6c262a6f8c0..3f500827cdf 100644 --- a/src/devices/machine/68561mpcc.cpp +++ b/src/devices/machine/68561mpcc.cpp @@ -76,10 +76,8 @@ FEATURES #ifdef _MSC_VER #define FUNCNAME __func__ -#define LLFORMAT "%I64d" #else #define FUNCNAME __PRETTY_FUNCTION__ -#define LLFORMAT "%lld" #endif //************************************************************************** diff --git a/src/devices/machine/mc14411.cpp b/src/devices/machine/mc14411.cpp index 8a3101af0c7..c1c3a62fd78 100644 --- a/src/devices/machine/mc14411.cpp +++ b/src/devices/machine/mc14411.cpp @@ -46,10 +46,8 @@ #ifdef _MSC_VER #define FUNCNAME __func__ -#define LLFORMAT "%I64d" #else #define FUNCNAME __PRETTY_FUNCTION__ -#define LLFORMAT "%lld" #endif diff --git a/src/devices/machine/nvram.cpp b/src/devices/machine/nvram.cpp index f58c8c1de52..ff3f852e050 100644 --- a/src/devices/machine/nvram.cpp +++ b/src/devices/machine/nvram.cpp @@ -166,5 +166,5 @@ void nvram_device::determine_final_base() // if we are region-backed for the default, find it now and make sure it's the right size if (m_region.found() && m_region->bytes() != m_length) - throw emu_fatalerror("%s",string_format("NVRAM device '%s' has a default region, but it should be 0x%I64uX bytes", tag(), m_length).c_str()); + throw emu_fatalerror("%s",string_format("NVRAM device '%s' has a default region, but it should be 0x%X bytes", tag(), m_length).c_str()); } diff --git a/src/devices/machine/z80sio.cpp b/src/devices/machine/z80sio.cpp index 5538f8b7a5a..83a8479f638 100644 --- a/src/devices/machine/z80sio.cpp +++ b/src/devices/machine/z80sio.cpp @@ -84,10 +84,8 @@ #ifdef _MSC_VER #define FUNCNAME __func__ -#define LLFORMAT "%I64d" #else #define FUNCNAME __PRETTY_FUNCTION__ -#define LLFORMAT "%lld" #endif #define CHANA_TAG "cha" diff --git a/src/devices/sound/disc_sys.hxx b/src/devices/sound/disc_sys.hxx index 5c1a79f0ec9..a83b26f30ed 100644 --- a/src/devices/sound/disc_sys.hxx +++ b/src/devices/sound/disc_sys.hxx @@ -61,7 +61,7 @@ DISCRETE_STEP( dso_csvlog ) int nodenum; /* Dump any csv logs */ - fprintf(m_csv_file, "%s", string_format("%I64d", ++m_sample_num).c_str()); + fprintf(m_csv_file, "%s", string_format("%d", ++m_sample_num).c_str()); for (nodenum = 0; nodenum < this->active_inputs(); nodenum++) { fprintf(m_csv_file, ", %f", *this->m_input[nodenum]); diff --git a/src/devices/video/sda5708.cpp b/src/devices/video/sda5708.cpp index 5b9973ba2cd..7049b295ca5 100644 --- a/src/devices/video/sda5708.cpp +++ b/src/devices/video/sda5708.cpp @@ -36,10 +36,8 @@ #ifdef _MSC_VER #define FUNCNAME __func__ -#define LLFORMAT "%I64d" #else #define FUNCNAME __PRETTY_FUNCTION__ -#define LLFORMAT "%lld" #endif |