Skip to content

Remove an unreachable endianness bug in mac_digit#343

Merged
cuviper merged 2 commits intorust-num:masterfrom
cuviper:mac_digit-dead-bug
Apr 21, 2026
Merged

Remove an unreachable endianness bug in mac_digit#343
cuviper merged 2 commits intorust-num:masterfrom
cuviper:mac_digit-dead-bug

Conversation

@cuviper
Copy link
Copy Markdown
Member

@cuviper cuviper commented Apr 21, 2026

This code wrongly created a [hi, lo] array to add its final carry digit, when that should be little-endian [lo, hi]. However, this was dead code because mac_with_carry always shifts >> BITS, so the carry value never has high bits at this point. We'll keep a debug assertion for that, but otherwise it's safe to assume.

This code wrongly created a `[hi, lo]` array to add its final carry
digit, when that should be little-endian `[lo, hi]`. However, this was
dead code because `mac_with_carry` always shifts `>> BITS`, so the
`carry` value **never** has high bits at this point. We'll keep a debug
assertion for that, but otherwise it's safe to assume.
@cuviper
Copy link
Copy Markdown
Member Author

cuviper commented Apr 21, 2026

AFAICT this bug was introduced in #141, but it was unreachable even then.

@cuviper cuviper enabled auto-merge April 21, 2026 21:29
@cuviper cuviper added this pull request to the merge queue Apr 21, 2026
Merged via the queue into rust-num:master with commit b8a216b Apr 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant