Is there a portable and safe way to interpret the bit-pattern made by a boost::uint16_t
as a boost::int16_t
? I have a uint16_t
, which I know represents a signed 16-bit integer encoded as little-endian. I need to do some signed arithmetic on this value, so is there anyway to convince the compiler that it already is a signed value?
If I a not mistaken, a static_cast<int16_t>
would convert the value, perhaps changing its bit-pattern.