| | 32 | |
| | 33 | #if 0 |
| | 34 | |
| | 35 | /* I need to do more testing of these macros */ |
| | 36 | |
| | 37 | #define min_of_type(x) \ |
| | 38 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), long double), LDBL_MIN, \ |
| | 39 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), double), DBL_MIN, \ |
| | 40 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), float), FLT_MIN, \ |
| | 41 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), char), 0, \ |
| | 42 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), signed char), INT8_MIN, \ |
| | 43 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), short), INT16_MIN, \ |
| | 44 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), int), INT32_MIN, \ |
| | 45 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), long), (__builtin_choose_expr(sizeof(x) == 4, INT32_MIN, INT64_MIN)), \ |
| | 46 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), long long), INT64_MIN, \ |
| | 47 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned char), 0, \ |
| | 48 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned short), 0, \ |
| | 49 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned int), 0, \ |
| | 50 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned long), 0, \ |
| | 51 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned long long), 0, \ |
| | 52 | (void)0)))))))))))))) |
| | 53 | |
| | 54 | #define max_of_type(x) \ |
| | 55 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), long double), LDBL_MAX, \ |
| | 56 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), double), DBL_MAX, \ |
| | 57 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), float), FLT_MAX, \ |
| | 58 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), char), UINT8_MAX, \ |
| | 59 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), signed char), INT8_MAX, \ |
| | 60 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), short), INT16_MIN, \ |
| | 61 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), int), INT32_MAX, \ |
| | 62 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), long), (__builtin_choose_expr(sizeof(x) == 4, INT32_MAX, INT64_MAX)), \ |
| | 63 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), long long), INT64_MAX, \ |
| | 64 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned char), UINT8_MAX, \ |
| | 65 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned short), UINT16_MAX, \ |
| | 66 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned int), UINT32_MAX, \ |
| | 67 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned long), (__builtin_choose_expr(sizeof(x) == 4, UINT32_MAX, UINT64_MAX)), \ |
| | 68 | __builtin_choose_expr(__builtin_types_compatible_p(typeof(x), unsigned long long), UINT64_MAX, \ |
| | 69 | (void)0)))))))))))))) |
| | 70 | |
| | 71 | #endif |
| | 72 | |