mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-28 07:47:02 -05:00
includes/type: Fixed size type visualizer
This commit is contained in:
@@ -9,13 +9,15 @@ namespace type {
|
||||
namespace impl {
|
||||
|
||||
fn size_formatter(u128 size) {
|
||||
double sizeValue = size;
|
||||
|
||||
u32 i = 0;
|
||||
while (size >= 1024 && i <= 6) {
|
||||
while (sizeValue >= 1024 && i <= 6) {
|
||||
i += 1;
|
||||
size /= 1024;
|
||||
sizeValue /= 1024;
|
||||
}
|
||||
|
||||
str result = std::format("{} ", size);
|
||||
str result = std::format("{:.3f} ", sizeValue);
|
||||
|
||||
if (i == 0 && size == 1)
|
||||
return result + "Byte";
|
||||
@@ -37,4 +39,4 @@ namespace type {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user