From cdf3fd178062f5beaf757f27f01feef2aa1ede41 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sun, 1 Dec 2024 17:17:28 -0500 Subject: [PATCH] Tooltip data display: Format floats and doubles better Floats and doubles will now always be displayed with a decimal point and one digit after it, even if they are whole numbers. Floats will also have the f suffix. This is so you can tell the data type just by glancing at the value. --- objdiff-core/src/arch/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/objdiff-core/src/arch/mod.rs b/objdiff-core/src/arch/mod.rs index 2f8e58c..5fc2d01 100644 --- a/objdiff-core/src/arch/mod.rs +++ b/objdiff-core/src/arch/mod.rs @@ -95,10 +95,10 @@ impl DataType { } } DataType::Float => { - format!("Float: {}", Endian::read_f32(bytes)) + format!("Float: {:?}f", Endian::read_f32(bytes)) } DataType::Double => { - format!("Double: {}", Endian::read_f64(bytes)) + format!("Double: {:?}", Endian::read_f64(bytes)) } DataType::Bytes => { format!("Bytes: {:#?}", bytes)