symmetric signed types
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Jan 25 10:53:30 PST 2014
On 1/25/14 9:35 AM, "Ola Fosheim Grøstad"
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Saturday, 25 January 2014 at 17:15:56 UTC, Ola Fosheim Grøstad wrote:
>> Fortunately most CPUS have ones-complement so the result is
>
> Err... "Two's complement." Nngh! Anyway, the basic idea is to think of
> minus for unsigned integers as ~x + 1, not as a operation using negative
> integers. Then it makes sense.
Of course it does. It was the point of my post. It's just that the type
is surprising from a basic arithmetic viewpoint.
Andrei
More information about the Digitalmars-d
mailing list