128 bit signed and unsigned integer types

bearophile bearophileHUGS at lycos.com
Sun Dec 28 03:26:18 PST 2008

Walter Bright:
> It can be done (not impractical at all), the issue is is it worth while?

128 bit are two words in the 64-bit CPUs that are now getting very common. So it's  like 64 bit operations on 32 bit CPUs.

A possible use is for runtime test for overflows: you can perform operations among 64 bit integers with 128 bit precision, and then you can look at the result if it fits still in 64 bits. If not, you can raise an overflow exception (probably there other ways to test for overflow, but this seems simple to implement). You can use 64 bits to implement the safe operations among 32-16-8 bit numbers on the 64 bit CPUs).


More information about the Digitalmars-d mailing list