Changeset 69835 in vbox
- Timestamp:
- Nov 26, 2017 5:13:40 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/tools/RTLs.cpp
r69625 r69835 535 535 if (pOpts->fHumanReadableSizes) 536 536 { 537 static const struct 538 { 539 const char *pszSuffix; 540 uint64_t cbFactor; 541 uint64_t cbMin; 542 } s_aUnits[] = 543 { 544 { "E", _1E, _1E + _1E/2 }, 545 { "P", _1P, _1P + _1P/2 }, 546 { "T", _1T, _1T + _1T/2 }, 547 { "G", _1G, _1G + _1G/2 }, 548 { "M", _1M, _1M + _1M/2 }, 549 { "k", _1K, _1K + _1K/2 }, 550 551 { "E", UINT64_C(1000000000000000000), UINT64_C(1010000000000000000), }, 552 { "P", UINT64_C(1000000000000000), UINT64_C(1010000000000000), }, 553 { "T", UINT64_C(1000000000000), UINT64_C(1010000000000), }, 554 { "G", UINT64_C(1000000000), UINT64_C(1010000000), }, 555 { "M", UINT64_C(1000000), UINT64_C(1010000), }, 556 { "K", UINT64_C(1000), UINT64_C(1010), }, 557 }; 558 unsigned const iEnd = !pOpts->fSiUnits ? 6 : 12; 559 for (unsigned i = !pOpts->fSiUnits ? 0 : 6; i < iEnd; i++) 560 if (cb >= s_aUnits[i].cbMin) 561 { 562 RTStrFormatU64(pszDst, cbDst, cb / s_aUnits[i].cbFactor, 10, 0, 0, 0); 563 RTStrCat(pszDst, cbDst, s_aUnits[i].pszSuffix); 564 return pszDst; 565 } 537 if (!pOpts->fSiUnits) 538 { 539 size_t cch = RTStrPrintf(pszDst, cbDst, "%Rhub", cb); 540 if (pszDst[cch - 1] == 'i') 541 pszDst[cch - 1] = '\0'; /* drop the trailing 'i' */ 542 } 543 else 544 RTStrPrintf(pszDst, cbDst, "%Rhui", cb); 566 545 } 567 546 else if (pOpts->cbBlock)
Note:
See TracChangeset
for help on using the changeset viewer.