casting int to uint and vice versa - performance
Don
nospam at nospam.com
Fri Dec 3 22:45:42 PST 2010
spir wrote:
> On Fri, 03 Dec 2010 17:49:47 -0500
> "Steven Schveighoffer" <schveiguy at yahoo.com> wrote:
>
>>> just that i + i generates different instructions than ui + ui where int
>>> i; uint ui;
>>>
>>> Not really important, because I'm currently interested in cast only.
>>>
>>> Thank you.
>> That is odd, I would think that i+i generates the same instructions as
>> ui+ui. As far as I know, adding unsigned and signed is the same
>> instruction, but unsigned add just ignores the carry bit.
>
> That used to be true (at least on some machines, a long time ago).
>
> Denis
> -- -- -- -- -- -- --
> vit esse estrany ☣
>
> spir.wikidot.com
>
It's only multiply, divide, and right shift where the instructions are
different.
More information about the Digitalmars-d-learn
mailing list