This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Integer conversion

Hello,

I wonder how the TI compiler treats unsigned-to-signed integer conversions, particularly on the C64x family of DSPs. The conversion is implementation-defined if the unsigned value is not representable in the signed type. Given that the integer representation is two's-complement, I'd be surprised if the conversion was not simply "mod 2^N", but I cannot find anything in the documentation.

Kind regards

Markus Moll

  • There are three cases to consider.

    If both ints are the same size, the bit string does not change at all.  Only the associated type changes.

    If the unsigned int is smaller, it is zero extended to the size of the larger int.

    If the unsigned int is larger, the upper bits are discarded.

    Thanks and regards,

    -George