File indexing completed on 2026-04-09 07:49:13
0001
0002
0003 #define fitsInShort(x) !(((((x) & 0xffff8000) >> 15) + 1) & 0x1fffe)
0004
0005 #include <cstdio>
0006 #include <limits>
0007
0008 int main()
0009 {
0010 int short_min = std::numeric_limits<short>::min() ;
0011 int short_max = std::numeric_limits<short>::max() ;
0012
0013 printf(" short_min %d short_max %d \n", short_min, short_max );
0014
0015 for(int i=short_min-10 ; i <= short_max+10 ; i++)
0016 {
0017 bool ok = fitsInShort(i);
0018 if( !ok || i < short_min + 100 || i > short_max - 100 )
0019 printf( " i %6d 0x%0.6x -i %6d -0x %0.6x ok %d \n", i, i, -i, -i, ok );
0020 }
0021
0022 return 0 ;
0023 }