casting int to uint and vice versa - performance

spir denis.spir at gmail.com
Fri Dec 3 15:18:17 PST 2010


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



More information about the Digitalmars-d-learn mailing list