convert int to short

Robert Fraser fraserofthenight at
Wed Oct 29 01:35:13 PDT 2008

James wrote:
> can anybody tell me how to convert int value to short since normal type-casting would return diff value (im not familiar with bit-shift, etc.)

Assuming the int can fit in a short (that is, it is between -32768 and 
32767, inclusive) just use cast(short). Otherwise... well, that's for 
you to figure out depending on the needs of your application.

More information about the Digitalmars-d-learn mailing list