change wrong assertion into condition

This commit is contained in:
silverweed 2025-02-11 13:16:18 +01:00
parent 1782c8c99e
commit f68aae33cf

View file

@ -757,7 +757,7 @@ struct Sec_Hover_Fn {
f32 xf = ROOT::Experimental::Internal::HalfToFloat(x);
return push_str8_node_child(arena, prev, fmt, xf);
});
// TODO
// XXX: these require piecing back "page-global" data and are currently unsupported.
// case CT::kSplitIndex64:
// case CT::kSplitIndex32:
// case CT::kSplitReal64:
@ -768,6 +768,7 @@ struct Sec_Hover_Fn {
// case CT::kSplitUInt32:
// case CT::kSplitInt16:
// case CT::kSplitUInt16:
// XXX: these require sub-byte addressing and are currently unsupported.
// case CT::kReal32Trunc:
// case CT::kReal32Quant:
// case CT::kBit:
@ -1044,11 +1045,13 @@ struct Sec_Hover_Fn {
} else {
Page_Info_Node *pinfo = (Page_Info_Node *)section.info;
b8 display_individual = !display_grouped;
if (display_individual && pinfo) {
assert(is_pow2(pinfo->bits_per_elem));
// TODO: currently we only support displaying elements whose size in bits on disk
// is a multiple of 8. We should lift this requirement to be able to display stuff like
// Real32Trunc, Real32Quant etc.
if (display_individual && pinfo && is_pow2(pinfo->bits_per_elem)) {
u64 n_elems = std::abs(pinfo->n_elems);
u64 field_len = pinfo->bits_per_elem / 8;
// align cur_field_off to the start of the element
// Align cur_field_off to the start of the element.
u64 off_in_elems = off - cur_field_off;
off_in_elems = (off_in_elems & ~(field_len - 1));
u64 elem_idx = off_in_elems / field_len;