Commit aeb42bd
Avoid redundant upcasts in UInt8/UInt16 comparisons
When both operands of a comparison are atomic (variables, field accesses,
function results — not arithmetic expressions), strip the unnecessary
Cast(_, UInt32) wrappers and compare at native width.
Before: (uint32_t)a == (uint32_t)b (redundant casts)
After: a == b (clean, no casts)
Arithmetic comparisons are unaffected — they still widen and mask:
((uint32_t)a + (uint32_t)b & 0xFFU) == (uint32_t)c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent aa23aa4 commit aeb42bd
2 files changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
0 commit comments