From: Kevin Day Date: Sat, 27 Jul 2019 00:28:45 +0000 (-0500) Subject: Bugfix: type sizes autodetection is not reporting proper sizes X-Git-Tag: 0.5.0~502 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=62b5a2d4498c589db3f1e1198d9bd893ef5074e2;p=fll Bugfix: type sizes autodetection is not reporting proper sizes Expected sizes are not being returned. Rewrite the logic to get casting to the highest value to work as desired. --- diff --git a/level_0/f_types/c/types.h b/level_0/f_types/c/types.h index 5cb86cc..76d47c5 100644 --- a/level_0/f_types/c/types.h +++ b/level_0/f_types/c/types.h @@ -102,22 +102,19 @@ extern "C" { #endif // _di_f_status_ // Defines the maximum size to be supported -// I hope these don't get optimized away and are detected at runtime as a result of the bitwise operator #ifndef _di_f_types_sizes_ - #define f_unsigned_char_size (~(unsigned char) 0) - #define f_unsigned_short_size (~(unsigned short) 0) - #define f_unsigned_int_size (~(unsigned int) 0) - #define f_unsigned_long_size (~(unsigned long) 0) - #define f_unsigned_long_long_size (~(unsigned long long) 0) - #define f_unsigned_double_size (~(unsigned double) 0) - #define f_unsigned_long_double_size (~(unsigned double) 0) - #define f_signed_char_size ((~(unsigned char) 0) / 2) - #define f_signed_short_size ((~(unsigned short) 0) / 2) - #define f_signed_int_size ((~(unsigned int) 0) / 2) - #define f_signed_long_size ((~(unsigned long) 0) / 2) - #define f_signed_long_long_size ((~(unsigned long long) 0) / 2) - #define f_signed_double_size ((~(unsigned double) 0) / 2) - #define f_signed_long_double_size ((~(unsigned double) 0) / 2) + #define f_unsigned_char_size ((unsigned char) -1) + #define f_unsigned_short_size ((unsigned short) -1) + #define f_unsigned_int_size ((unsigned int) -1) + #define f_unsigned_long_size ((unsigned long) -1) + #define f_unsigned_long_long_size ((unsigned long long) -1) + #define f_unsigned_double_size ((unsigned double) -1) + #define f_unsigned_long_double_size ((unsigned double) -1) + #define f_signed_char_size (((unsigned char) -1) / 2) + #define f_signed_short_size (((unsigned short) -1) / 2) + #define f_signed_int_size (((unsigned int) -1) / 2) + #define f_signed_long_size (((unsigned long) -1) / 2) + #define f_signed_long_long_size (((unsigned long long) -1) / 2) #endif // _di_f_types_sizes_ // These should define some types use by stdio