4 ms·
Years ago, I've helped giving Rust support for 128 bit integers as one of my first big contributions to rustc. As part of that work, I ported some of the routin
by est31 4y ago
Years ago, I've helped giving Rust support for 128 bit integers as one of my first big contributions to rustc. As part of that work, I ported some of the routines concerning 128 bit numbers from C to Rust. That language conversion alone made the implementation more portable, as clang doesn't support 128 bit numbers on all targets. On the flip side, this led to the occasional LLVM bug/limitation being hit because backends are usually written with C in mind, and sometimes even the authors of the backends struggle because the 128 bit routines are a stress test for the register allocator. Another resolved issue is that u128::MAX is not representable as f32, and thus the cast was UB: https://github.com/rust-lang/rust/issues/41799 https://github.com/rust-lang/rust/issues/41799.
The routines have been rewritten/refactored multiple times since, and I had zero involvement in the LLVM work, but I'm still amazed that I was able to hack on code as fundamental as this and being part of shipping a new width for numbers in a "big" language (certainly big now).