Skip to content

Commit 131d1fa

Browse files
committed
Update Memory View
add 2 rows showing floating point interpretation of the byte (single and double precision) partially addresses #51
1 parent ce1f54a commit 131d1fa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/df/gfx/df_views.c

+8
Original file line numberDiff line numberDiff line change
@@ -9081,6 +9081,8 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
90819081
ui_labelf("U16:");
90829082
ui_labelf("U32:");
90839083
ui_labelf("U64:");
9084+
ui_labelf("F32:");
9085+
ui_labelf("F64:");
90849086
}
90859087
UI_PrefWidth(ui_em(45.f, 1.f)) UI_HeightFill UI_Column UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_CodeNumeric))
90869088
UI_PrefHeight(ui_px(row_height_px, 0.f))
@@ -9093,15 +9095,21 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
90939095
U64 as_u16 = 0;
90949096
U64 as_u32 = 0;
90959097
U64 as_u64 = 0;
9098+
F32 as_f32 = 0;
9099+
F64 as_f64 = 0;
90969100
U64 cursor_off = mv->cursor-viz_range_bytes.min;
90979101
as_u8 = (U64)*(U8 *)(visible_memory + cursor_off);
90989102
as_u16 = (U64)*(U16*)(visible_memory + cursor_off);
90999103
as_u32 = (U64)*(U32*)(visible_memory + cursor_off);
91009104
as_u64 = (U64)*(U64*)(visible_memory + cursor_off);
9105+
as_f32 = (F32)*(F32*)(visible_memory + cursor_off);
9106+
as_f64 = (F64)*(F64*)(visible_memory + cursor_off);
91019107
ui_labelf("%02X (%I64u)", as_u8, as_u8);
91029108
ui_labelf("%04X (%I64u)", as_u16, as_u16);
91039109
ui_labelf("%08X (%I64u)", as_u32, as_u32);
91049110
ui_labelf("%016I64X (%I64u)", as_u64, as_u64);
9111+
ui_labelf("%+.8e (%+.6a)", as_f32, as_f32);
9112+
ui_labelf("%+.17e (%+.13a)", as_f64, as_f64);
91059113
}
91069114
}
91079115
}

0 commit comments

Comments
 (0)