diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2010-12-21 11:35:28 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2010-12-21 11:35:28 +0100 |
commit | 5da40cbf6daae35ad4948476bac7827f81ee7904 (patch) | |
tree | 0474f9a04f593f1090b6f9ffff5c61885d425618 | |
parent | a5fd477ceb5f5c130a39d0415b3ea82c697b131a (diff) |
Correct size scaling functions
-rw-r--r-- | nios2sim-ng.h | 10 |
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; |