Down cast from 32 Bit to 16 Bit.
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
Is there a standard way in c (not c++) to down cast and get the maximum value if "loose significant digits"? e.g. /* ISO-c99: */ #include int16_t cast32To16( int32_t the32) { if( the32 => INT16_MAX ) return INT16_MAX; if( the32 <= INT16_MIN ) return INT16_MIN; return (int16_t) the32; } Friedrich
-
Is there a standard way in c (not c++) to down cast and get the maximum value if "loose significant digits"? e.g. /* ISO-c99: */ #include int16_t cast32To16( int32_t the32) { if( the32 => INT16_MAX ) return INT16_MAX; if( the32 <= INT16_MIN ) return INT16_MIN; return (int16_t) the32; } Friedrich
Ralf Friedrich Hain wrote: Is there a standard way in c (not c++) to down cast and get the maximum value if "loose significant digits"? Answer: No! INTP