Just square the value of the 8bit variable. The 8bit value 256, will then end up being 65536 (the max for a 16bit variable), but 0 will still be 0. Is that what you wanted?The resulting data will of course not be any more accurate than the original 8bit data though.Code:unsigned char some_value = 128; unsigned short resulting_value = static_cast<unsigned short>(some_value) * static_cast<unsigned short>(some_value);




Reply With Quote