On 12 January 2014 19:02, Isaac Dupree <[email protected]>wrote:
> Another sweet spot for a few applications is larger-than-word-sized > fixed-width types, such as a 128 or 192 bit (u)int. This is useful for > code that has to deal with values larger than 64 bits but within, say, 256 > or 512 bits (above this, I think the costs of dynamic allocation and > non-inlined numeric code become cheap-ish compared to the numeric > computation and storage costs). I've done this with C++ templates; it > works pretty okay; it sure makes GCC/LLVM's register allocator work hard! > -Isaac > > A minor variation of "checked_add" (i.e. add_with_carry) would take care of this. Obviously also need a multiply which returns the two result halves also. For implementing bignum arithmetic, this is obviously a point where a "natural int" type would be best (probably the biggest which fits a single register) Owen Shepherd http://owenshepherd.net | [email protected]
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
