]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Switch to Binary Size Prefixes (e.g., "MB" -> "MiB")
authorW. Felix Handte <w@felixhandte.com>
Thu, 10 Jun 2021 16:06:51 +0000 (12:06 -0400)
committerW. Felix Handte <w@felixhandte.com>
Thu, 10 Jun 2021 16:53:07 +0000 (12:53 -0400)
Suggested by @aqrit, a little more verbose, but hopefully addresses a real
ambiguity.

programs/util.c

index 2622ae825fad20953b918028d3dbd152af8d4ce2..96459b9d39cc009b045670bbf31f0f0366b32ae0 100644 (file)
@@ -311,7 +311,7 @@ UTIL_HumanReadableSize_t UTIL_makeHumanReadableSize(U64 size) {
          * values that exceed the integral precision of a double. */
         if (size >= (1ull << 53)) {
             hrs.value = (double)size / (1ull << 20);
-            hrs.suffix = " MB";
+            hrs.suffix = " MiB";
             /* At worst, a double representation of a maximal size will be
              * accurate to better than tens of kilobytes. */
             hrs.precision = 2;
@@ -324,22 +324,22 @@ UTIL_HumanReadableSize_t UTIL_makeHumanReadableSize(U64 size) {
         /* In regular mode, scale sizes down and use suffixes. */
         if (size >= (1ull << 60)) {
             hrs.value = (double)size / (1ull << 60);
-            hrs.suffix = " EB";
+            hrs.suffix = " EiB";
         } else if (size >= (1ull << 50)) {
             hrs.value = (double)size / (1ull << 50);
-            hrs.suffix = " PB";
+            hrs.suffix = " PiB";
         } else if (size >= (1ull << 40)) {
             hrs.value = (double)size / (1ull << 40);
-            hrs.suffix = " TB";
+            hrs.suffix = " TiB";
         } else if (size >= (1ull << 30)) {
             hrs.value = (double)size / (1ull << 30);
-            hrs.suffix = " GB";
+            hrs.suffix = " GiB";
         } else if (size >= (1ull << 20)) {
             hrs.value = (double)size / (1ull << 20);
-            hrs.suffix = " MB";
+            hrs.suffix = " MiB";
         } else if (size >= (1ull << 10)) {
             hrs.value = (double)size / (1ull << 10);
-            hrs.suffix = " KB";
+            hrs.suffix = " KiB";
         } else {
             hrs.value = (double)size;
             hrs.suffix = " B";