add trivial new iprefix()

This commit is contained in:
nick black 2020-08-20 17:37:12 -04:00
parent bc0016b827
commit 2e5a8b78d5
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,9 @@ rearrangements of Notcurses.
more general form, capable of projecting arbitrary subregions of the source
plane down to the destination plane. The source argument to
`ncplane_mergedown_simple()` is now `const`.
* `iprefix()` has been added, corresponding to `IPREFIXSTRLEN`. This ought
be used if you want binary prefixes without the 'i' suffix indicating
binary prefixes, which I predict will endear you to exactly no one.
* 1.6.15 (2020-08-16)
* Styles now work properly with `ncdirect`, which apparently has never

View File

@ -2526,6 +2526,12 @@ qprefix(uintmax_t val, uintmax_t decimal, char* buf, int omitdec){
return ncmetric(val, decimal, buf, omitdec, 1000, '\0');
}
// Mibi, kebi, gibibytes sans 'i' suffix. Use IPREFIXSTRLEN + 1.
static inline const char*
iprefix(uintmax_t val, uintmax_t decimal, char* buf, int omitdec){
return ncmetric(val, decimal, buf, omitdec, 1024, '\0');
}
// Mibi, kebi, gibibytes. Use BPREFIXSTRLEN + 1.
static inline const char*
bprefix(uintmax_t val, uintmax_t decimal, char* buf, int omitdec){