Re:How Rust 1.26 more than tripled the speed of my code
by wallnuss on Monday May 14, 2018 @11:37PM
(#17071472)
Julia has `widemul` which takes two `Int64` and produces an `Int128`. It is also not to hard to actually add your own primitive type for `Int256` (with the caveat that it needs support from LLVM, which I haven't checked)
[ed: ok, from a skim, I see this is actually about 256bit multiplication - which makes me curious how just using bigints and * (mul operator) would work in Julia.
Also, I don't get this:
> u256_mul multiplies two 256-bit numbers to get a 256-bit result (in Rust, we just create a 512-bit result and then throw away the top half but in assembly we have a seperate implementation)
How do they know the result will fit in 256 bits? Sounds like they know more about the arguments than both having to be 256 bits long?
Or do they want multiply and shift?]