Use integer progress fractions#1959
Conversation
|
Added two more commits with small fixes, PTAL @cedwies |
| (input_index as f32 + subprogress) * step | ||
| }); | ||
| progress_component.set_fraction( | ||
| input_index * prevtx_total_ios + prevtx_input_index, |
There was a problem hiding this comment.
You already fixed the wrap around in C by using int64 instead of int32. What about here in rust?
There was a problem hiding this comment.
If we change params from u32 to u64 here, then in C it could overflow uint64_t 😂
Since no one is expected to run into this, I converted it to checked arithmetic that fails on overflow. See new commit.
There was a problem hiding this comment.
If we change params from u32 to u64 here, then in C it could overflow uint64_t
🥲
Checked arithmetic is great 👍
Add an integer `set_fraction()` progress path through the HAL and UI layers,
and switch the live Bitcoin-signing and Bluetooth-upgrade progress updates to
use it.
The progress bar ultimately renders whole pixels, so the C progress component
now stores the filled pixel width directly and computes it with integer math.
This keeps the visible behavior intact while removing the Rust-side soft-float
`f32` arithmetic path that was only used for progress updates.
In the final firmware image this drops the live
`compiler_builtins::float::{add,div,mul}::<f32>` helpers together with the
associated `__aeabi_fadd`, `__aeabi_fdiv`, and `__aeabi_fmul` wrappers.
Savings: 1352 bytes
Extend .ci/check-unwanted-symbols with additional checks for linked floating-point helpers in build/bin/firmware.elf. Keep the existing float formatting, strftime, and sha2::Sha512 checks, and add floating-point helper checks for the helpers removed by the integer fee and progress commits. The f64 check is intentionally scoped to comparison/conversion helpers because this branch still has some double arithmetic helpers pulled in by the existing C snprintf/newlib path.
Compute the filled pixel width with a 64-bit product so large valid fractions cannot wrap before division.
Render filled progress pixels within the inclusive screen bounds and skip drawing when the filled width is zero.
cedwies
left a comment
There was a problem hiding this comment.
utACK
Non blocking: a small regression test with oversized prevtx input/output counts would make this harder to accidentally undo later
No description provided.