summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nios2sim-ng.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/nios2sim-ng.h b/nios2sim-ng.h
index 9be1d0d..40cb2dd 100644
--- a/nios2sim-ng.h
+++ b/nios2sim-ng.h
@@ -26,15 +26,17 @@ extern bool verbose;
do { if (verbose) fprintf(stdout, fmt, ##args); } while (0)
#ifdef DEBUG
# define dbg(fmt, args...) fprintf(stdout, fmt, ##args)
+# define trace(fmt, args...) dbg("%s: " fmt, __func__, ##args)
#else
# define dbg(fmt, args...)
+# define trace(fmt, args...)
#endif
static inline size_t size_scale(size_t size)
{
- if (size > 1024 * 1024)
+ if (size >= 1024 * 1024)
size /= 1024 * 1024;
- else if (size > 1024)
+ else if (size >= 1024)
size /= 1024;
return size;
@@ -44,9 +46,9 @@ static inline char *size_postfix(size_t size)
{
char *ret = "";
- if (size > 1024 * 1024)
+ if (size >= 1024 * 1024)
ret = "M";
- else if (size > 1024)
+ else if (size >= 1024)
ret = "K";
return ret;