On Tuesday 17 December 2013 20:24:27 Sieghard wrote:

>
> BUT: Does anybody _really_ think that type casting _does_ something?
>
> A type cast, CPU wise, is a no-op, quite simply.

Correct, if the sizes of the types are the same a type conversion says to the 
compiler "I know what I do".

For the conversion from smaller to bigger it either 
- sign extends the value if the conversion is signed to signed:
"
 int32var:= int32(int16value);
"
- it fills the upper bytes with 0 if the smaller or the bigger is unsigned:
"
 card32var:= card32(card16value);
 card32var:= card32(int16value); //possible range check?
 int32var:= int32(card16value);
"
If the conversion is from bigger to smaller it truncates to the lower bytes 
with a possible range check.
"
 card16var:= card16(card32value);
 card16var:= card16(int32value);
 int16var:= int16(card32value);
 int16var:= int16(int32value);
"

Martin

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to