@@ -8,6 +8,7 @@ Author: Daniel Kroening, kroening@kroening.com
88
99#include " config.h"
1010
11+ #include < climits>
1112#include < cstdlib>
1213
1314#include " arith_tools.h"
@@ -1010,42 +1011,43 @@ bool configt::set(const cmdlinet &cmdline)
10101011 if (arch==this_arch && os==this_os)
10111012 {
10121013 INVARIANT (
1013- ansi_c.int_width == sizeof (int ) * 8 ,
1014+ ansi_c.int_width == sizeof (int ) * CHAR_BIT ,
10141015 " int width shall be equal to the system int width" );
10151016 INVARIANT (
1016- ansi_c.long_int_width == sizeof (long ) * 8 ,
1017+ ansi_c.long_int_width == sizeof (long ) * CHAR_BIT ,
10171018 " long int width shall be equal to the system long int width" );
10181019 INVARIANT (
1019- ansi_c.bool_width == sizeof (bool ) * 8 ,
1020+ ansi_c.bool_width == sizeof (bool ) * CHAR_BIT ,
10201021 " bool width shall be equal to the system bool width" );
10211022 INVARIANT (
1022- ansi_c.char_width == sizeof (char ) * 8 ,
1023+ ansi_c.char_width == sizeof (char ) * CHAR_BIT ,
10231024 " char width shall be equal to the system char width" );
10241025 INVARIANT (
1025- ansi_c.short_int_width == sizeof (short ) * 8 ,
1026+ ansi_c.short_int_width == sizeof (short ) * CHAR_BIT ,
10261027 " short int width shall be equal to the system short int width" );
10271028 INVARIANT (
1028- ansi_c.long_long_int_width == sizeof (long long ) * 8 ,
1029+ ansi_c.long_long_int_width == sizeof (long long ) * CHAR_BIT ,
10291030 " long long int width shall be equal to the system long long int width" );
10301031 INVARIANT (
1031- ansi_c.pointer_width == sizeof (void *) * 8 ,
1032+ ansi_c.pointer_width == sizeof (void *) * CHAR_BIT ,
10321033 " pointer width shall be equal to the system pointer width" );
10331034 INVARIANT (
1034- ansi_c.single_width == sizeof (float ) * 8 ,
1035+ ansi_c.single_width == sizeof (float ) * CHAR_BIT ,
10351036 " float width shall be equal to the system float width" );
10361037 INVARIANT (
1037- ansi_c.double_width == sizeof (double ) * 8 ,
1038+ ansi_c.double_width == sizeof (double ) * CHAR_BIT ,
10381039 " double width shall be equal to the system double width" );
10391040 INVARIANT (
1040- ansi_c.char_is_unsigned == (static_cast <char >(255 ) == 255 ),
1041+ ansi_c.char_is_unsigned ==
1042+ (static_cast <char >((1 << CHAR_BIT) - 1 ) == (1 << CHAR_BIT) - 1 ),
10411043 " char_is_unsigned flag shall indicate system char unsignedness" );
10421044
1043- #ifndef _WIN32
1045+ #ifndef _WIN32
10441046 // On Windows, long double width varies by compiler
10451047 INVARIANT (
1046- ansi_c.long_double_width == sizeof (long double ) * 8 ,
1048+ ansi_c.long_double_width == sizeof (long double ) * CHAR_BIT ,
10471049 " long double width shall be equal to the system long double width" );
1048- #endif
1050+ #endif
10491051 }
10501052
10511053 // the following allows overriding the defaults
0 commit comments