casting int to uint and vice versa - performance

Steven Schveighoffer schveiguy at yahoo.com
Fri Dec 3 13:44:42 PST 2010


On Fri, 03 Dec 2010 16:34:51 -0500, Michal Minich  
<michal.minich at gmail.com> wrote:

> What is performance overhead for casting value of type int to uint and in
> the opposite direction. What happen when I cast int to int or uint to  
> uint

Nothing, there is no performance, type is strictly a compile-time concept.

> (for the simplicity in generic code). I suppose there is no difference,
> and it is in fact no-op for processor - it depends only on
> interpretation. Only when making other operations compiler may generate
> different instruction when he considers some value of either of types. Am
> I right?

Not sure what you mean by that last part...

-Steve


More information about the Digitalmars-d-learn mailing list