Browse Source

[Minor] Properly print byte suffixes when humanizing

tags/1.9.1
Vsevolod Stakhov 5 years ago
parent
commit
05439698e0
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      src/libutil/printf.c

+ 3
- 3
src/libutil/printf.c View File



if (!bytes) { if (!bytes) {
divisor = 1000; divisor = 1000;
prefixes = "\0\0\0k\0\0M\0\0G\0\0T\0\0P\0\0E";
prefixes = "\0\0\0\0k\0\0\0M\0\0\0G\0\0\0T\0\0\0P\0\0\0E";
} }
else { else {
divisor = 1024; divisor = 1024;
prefixes = "B\0\0k\0\0M\0\0G\0\0T\0\0P\0\0E";
prefixes = "B\0\0\0KiB\0MiB\0GiB\0TiB\0PiB\0EiB";
} }


#define SCALE2PREFIX(scale) (&prefixes[(scale) * 3])
#define SCALE2PREFIX(scale) (&prefixes[(scale) * 4])


if (num < 0) { if (num < 0) {
sign = -1; sign = -1;

Loading…
Cancel
Save