You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(bigint): treat empty octets as zero in BigInt::from_octets
An empty big-endian magnitude naturally denotes zero, and mainstream
bigint APIs agree: Java's BigInteger(signum, magnitude) permits a
zero-length magnitude for any signum, Python's int.from_bytes(b"")
returns 0, and Rust's num-bigint normalizes Sign::Minus with an empty
magnitude to zero. Previously MoonBit was the outlier, aborting with
"empty octet string" whenever signum != 0, while still accepting the
morally identical all-zero magnitude (e.g. b"\x00" with signum=-1).
Relax the panic on both backends to return zero, update the docs, and
replace the panic tests with value tests covering every signum.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0 commit comments