57 #define ARRAY_SIZE(A) (sizeof (A) / sizeof ((A)[0]))
66 #define CHECK_EXP(UINON_TYPE, VALUE_TYPE, FMT) \
68 __attribute__((noinline, unused)) \
69 check_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
74 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
78 PRINTF ("%i: " FMT " != " FMT "\n", \
85 CHECK_EXP (union128i_b
, char, "%d")
86 CHECK_EXP (union128i_ub
, unsigned char, "%d")
87 CHECK_EXP (union128i_w
, short, "%d")
88 CHECK_EXP (union128i_uw
, unsigned short, "%d")
89 CHECK_EXP (union128i_d
, int, "0x%x")
90 CHECK_EXP (union128i_q
, long long, "0x%llx")
91 CHECK_EXP (union128d
, double, "%f")
94 CHECK_EXP (union128
, float, "%f")
96 #define ESP_FLOAT 0.000001
97 #define ESP_DOUBLE 0.000001
98 #define CHECK_ARRAY(ARRAY, TYPE, FMT) \
100 __attribute__((noinline, unused)) \
101 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
106 for (i = 0; i < n; i++) \
110 PRINTF ("%i: " FMT " != " FMT "\n", \
116 CHECK_ARRAY(i
, int, "0x%x")
117 CHECK_ARRAY(l
, long long, "0x%llx")
119 #define CHECK_FP_ARRAY(ARRAY, TYPE, ESP, FMT) \
121 __attribute__((noinline, unused)) \
122 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
127 for (i = 0; i < n; i++) \
128 if (v[i] > (e[i] + (ESP)) || v[i] < (e[i] - (ESP))) \
132 PRINTF ("%i: " FMT " != " FMT "\n", \
138 CHECK_FP_ARRAY (d
, double, ESP_DOUBLE
, "%f")
139 CHECK_FP_ARRAY (f
, float, ESP_FLOAT
, "%f")
141 #ifdef NEED_IEEE754_FLOAT
147 unsigned long frac
: 23;
150 } bits
__attribute__((packed
));
154 #ifdef NEED_IEEE754_DOUBLE
160 unsigned long frac1
: 32;
161 unsigned long frac0
: 20;
164 } bits
__attribute__((packed
));