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")
111 #define ESP_FLOAT 0.000001
112 #define ESP_DOUBLE 0.000001
113 #define CHECK_ARRAY(ARRAY, TYPE, FMT) \
115 __attribute__((noinline, unused)) \
116 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
121 for (i = 0; i < n; i++) \
125 PRINTF ("%i: " FMT " != " FMT "\n", \
131 CHECK_ARRAY(c
, char, "0x%hhx")
132 CHECK_ARRAY(s
, short, "0x%hx")
133 CHECK_ARRAY(i
, int, "0x%x")
134 CHECK_ARRAY(l
, long long, "0x%llx")
135 CHECK_ARRAY(uc
, unsigned char, "0x%hhx")
136 CHECK_ARRAY(us
, unsigned short, "0x%hx")
137 CHECK_ARRAY(ui
, unsigned int, "0x%x")
138 CHECK_ARRAY(ul
, unsigned long long, "0x%llx")
142 #define CHECK_FP_ARRAY(ARRAY, TYPE, ESP, FMT) \
144 __attribute__((noinline, unused)) \
145 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
150 for (i = 0; i < n; i++) \
151 if (v[i] > (e[i] + (ESP)) || v[i] < (e[i] - (ESP))) \
155 PRINTF ("%i: " FMT " != " FMT "\n", \
161 CHECK_FP_ARRAY (d
, double, ESP_DOUBLE
, "%f")
162 CHECK_FP_ARRAY (f
, float, ESP_FLOAT
, "%f")
164 #ifdef NEED_IEEE754_FLOAT
170 unsigned long frac
: 23;
173 } bits
__attribute__((packed
));
177 #ifdef NEED_IEEE754_DOUBLE
183 unsigned long frac1
: 32;
184 unsigned long frac0
: 20;
187 } bits
__attribute__((packed
));
191 #define CHECK_FP_EXP(UINON_TYPE, VALUE_TYPE, ESP, FMT) \
193 __attribute__((noinline, unused)) \
194 check_fp_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
199 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
200 if (u.a[i] > (v[i] + (ESP)) || u.a[i] < (v[i] - (ESP))) \
203 PRINTF ("%i: " FMT " != " FMT "\n", \
209 CHECK_FP_EXP (union128
, float, ESP_FLOAT
, "%f")
211 CHECK_FP_EXP (union128d
, double, ESP_DOUBLE
, "%f")