Fixed long long formatting for MinGW.

MinGW uses %I64d instead of %lld.
This commit is contained in:
Daniel Beer 2012-10-04 14:33:05 +12:00
parent 3da52fe100
commit 56ffd537b6
2 changed files with 12 additions and 5 deletions

View File

@ -71,7 +71,7 @@ static void event_print(const struct event *e)
char name[128]; char name[128];
print_address(e->addr, name, sizeof(name)); print_address(e->addr, name, sizeof(name));
printc(" %10lld: ", e->when); printc(" %10" LLFMT ": ", e->when);
switch (e->what) { switch (e->what) {
case EVENT_WRITE_16: case EVENT_WRITE_16:
@ -234,10 +234,10 @@ static int tracer_info(struct simio_device *dev)
struct tracer *tr = (struct tracer *)dev; struct tracer *tr = (struct tracer *)dev;
int i; int i;
printc("Instruction count: %lld\n", tr->inscount); printc("Instruction count: %" LLFMT "\n", tr->inscount);
printc("MCLK: %lld\n", tr->cycles[SIMIO_MCLK]); printc("MCLK: %" LLFMT "\n", tr->cycles[SIMIO_MCLK]);
printc("SMCLK %lld\n", tr->cycles[SIMIO_SMCLK]); printc("SMCLK %" LLFMT "\n", tr->cycles[SIMIO_SMCLK]);
printc("ACLK: %lld\n", tr->cycles[SIMIO_ACLK]); printc("ACLK: %" LLFMT "\n", tr->cycles[SIMIO_ACLK]);
if (tr->irq_request >= 0) if (tr->irq_request >= 0)
printc("IRQ pending: %d\n", tr->irq_request); printc("IRQ pending: %d\n", tr->irq_request);

View File

@ -73,4 +73,11 @@ char *expand_tilde(const char *path);
int delay_s(unsigned int s); int delay_s(unsigned int s);
int delay_ms(unsigned int s); int delay_ms(unsigned int s);
/* printf format for long long args */
#ifdef __MINGW32__
#define LLFMT "I64d"
#else
#define LLFMT "lld"
#endif
#endif #endif