52 unsigned long long a[2];
70 #define ARRAY_SIZE(A) (sizeof (A) / sizeof ((A)[0]))
79 #define CHECK_EXP(UINON_TYPE, VALUE_TYPE, FMT) \
81 __attribute__((noinline, unused)) \
82 check_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
87 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
91 PRINTF ("%i: " FMT " != " FMT "\n", \
98 CHECK_EXP (union128i_b, char, "%d")
99 CHECK_EXP (union128i_ub, unsigned char, "%d")
100 CHECK_EXP (union128i_w, short, "%d")
101 CHECK_EXP (union128i_uw, unsigned short, "%d")
102 CHECK_EXP (union128i_d, int, "0x%x")
103 CHECK_EXP (union128i_ud, unsigned int, "0x%x")
104 CHECK_EXP (union128i_q, long long, "0x%llx")
105 CHECK_EXP (union128i_uq, unsigned long long, "0x%llx")
106 CHECK_EXP (union128d, double, "%f")
109 CHECK_EXP (union128, float, "%f")
112 #define ESP_FLOAT 0.000001
115 #define ESP_DOUBLE 0.000001
117 #define CHECK_ARRAY(ARRAY, TYPE, FMT) \
119 __attribute__((noinline, unused)) \
120 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
125 for (i = 0; i < n; i++) \
129 PRINTF ("%i: " FMT " != " FMT "\n", \
135 CHECK_ARRAY(c, char, "0x%hhx")
136 CHECK_ARRAY(s, short, "0x%hx")
137 CHECK_ARRAY(i, int, "0x%x")
138 CHECK_ARRAY(l, long long, "0x%llx")
139 CHECK_ARRAY(uc, unsigned char, "0x%hhx")
140 CHECK_ARRAY(us, unsigned short, "0x%hx")
141 CHECK_ARRAY(ui, unsigned int, "0x%x")
142 CHECK_ARRAY(ul, unsigned long long, "0x%llx")
146 #define CHECK_FP_ARRAY(ARRAY, TYPE, ESP, FMT) \
148 __attribute__((noinline, unused)) \
149 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
154 for (i = 0; i < n; i++) \
155 if (v[i] > (e[i] + (ESP)) || v[i] < (e[i] - (ESP))) \
159 PRINTF ("%i: " FMT " != " FMT "\n", \
165 CHECK_FP_ARRAY (d, double, ESP_DOUBLE, "%f")
166 CHECK_FP_ARRAY (f, float, ESP_FLOAT, "%f")
168 #ifdef NEED_IEEE754_FLOAT
174 unsigned long frac : 23;
177 } bits __attribute__((packed));
181 #ifdef NEED_IEEE754_DOUBLE
187 unsigned long frac1 : 32;
188 unsigned long frac0 : 20;
191 } bits __attribute__((packed));
195 #define CHECK_FP_EXP(UINON_TYPE, VALUE_TYPE, ESP, FMT) \
197 __attribute__((noinline, unused)) \
198 check_fp_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
203 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
204 if (u.a[i] > (v[i] + (ESP)) || u.a[i] < (v[i] - (ESP))) \
207 PRINTF ("%i: " FMT " != " FMT "\n", \
213 CHECK_FP_EXP (union128, float, ESP_FLOAT, "%f")
215 CHECK_FP_EXP (union128d, double, ESP_DOUBLE, "%f")