mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-16 19:31:09 +00:00
Merge pull request #853 from akuker/rdmark-issue852
Calculate image sizes for the Product string using MiB/KiB units
This commit is contained in:
commit
71e070b59e
@ -41,13 +41,13 @@ void SCSIHD::FinalizeSetup(const Filepath &path, off_t size)
|
|||||||
if (!IsRemovable()) {
|
if (!IsRemovable()) {
|
||||||
uint64_t capacity = GetBlockCount() * GetSectorSizeInBytes();
|
uint64_t capacity = GetBlockCount() * GetSectorSizeInBytes();
|
||||||
string unit;
|
string unit;
|
||||||
if (capacity >= 1000000) {
|
if (capacity >= 1048576) {
|
||||||
capacity /= 1000000;
|
capacity /= 1048576;
|
||||||
unit = "MB";
|
unit = "MiB";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
capacity /= 1000;
|
capacity /= 1024;
|
||||||
unit = "KB";
|
unit = "KiB";
|
||||||
}
|
}
|
||||||
stringstream product;
|
stringstream product;
|
||||||
product << DEFAULT_PRODUCT << " " << capacity << " " << unit;
|
product << DEFAULT_PRODUCT << " " << capacity << " " << unit;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user