projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
iolog: ensure we always store compressed, if log_store_compressed == 1
[fio.git]
/
lib
/
num2str.c
diff --git
a/lib/num2str.c
b/lib/num2str.c
index 896186888716424f13ecf0dc174a416cffeb7bd6..0ed05f33ea8039b52f5c18a7574ef78adb4caac6 100644
(file)
--- a/
lib/num2str.c
+++ b/
lib/num2str.c
@@
-9,7
+9,7
@@
/*
* Cheesy number->string conversion, complete with carry rounding error.
*/
/*
* Cheesy number->string conversion, complete with carry rounding error.
*/
-char *num2str(u
nsigned long
num, int maxlen, int base, int pow2, int unit_base)
+char *num2str(u
int64_t
num, int maxlen, int base, int pow2, int unit_base)
{
const char *postfix[] = { "", "K", "M", "G", "P", "E" };
const char *byte_postfix[] = { "", "B", "bit" };
{
const char *postfix[] = { "", "K", "M", "G", "P", "E" };
const char *byte_postfix[] = { "", "B", "bit" };
@@
-36,7
+36,7
@@
char *num2str(unsigned long num, int maxlen, int base, int pow2, int unit_base)
modulo = -1U;
while (post_index < sizeof(postfix)) {
modulo = -1U;
while (post_index < sizeof(postfix)) {
- sprintf(tmp, "%l
u",
num);
+ sprintf(tmp, "%l
lu", (unsigned long long)
num);
if (strlen(tmp) <= maxlen)
break;
if (strlen(tmp) <= maxlen)
break;
@@
-51,12
+51,12
@@
done:
if (post_index >= ARRAY_LENGTH(postfix))
post_index = 0;
if (post_index >= ARRAY_LENGTH(postfix))
post_index = 0;
- sprintf(buf, "%l
u%s%s", num, postfix[post_index]
,
- byte_postfix[byte_post_index]);
+ sprintf(buf, "%l
lu%s%s", (unsigned long long) num
,
+
postfix[post_index],
byte_postfix[byte_post_index]);
return buf;
}
return buf;
}
- sprintf(tmp, "%l
u",
num);
+ sprintf(tmp, "%l
lu", (unsigned long long)
num);
decimals = maxlen - strlen(tmp);
if (decimals <= 1) {
if (carry)
decimals = maxlen - strlen(tmp);
if (decimals <= 1) {
if (carry)
@@
-72,7
+72,7
@@
done:
modulo = (modulo + 9) / 10;
} while (1);
modulo = (modulo + 9) / 10;
} while (1);
- sprintf(buf, "%l
u.%u%s%s", num, modulo, postfix[post_index]
,
- byte_postfix[byte_post_index]);
+ sprintf(buf, "%l
lu.%u%s%s", (unsigned long long) num, modulo
,
+
postfix[post_index],
byte_postfix[byte_post_index]);
return buf;
}
return buf;
}