ck_pr: Add appropriate casts to ck_pr_cas unit test.

ck_pring
Samy Al Bahra 13 years ago
parent 9dd525d9ee
commit 544de60849

@ -37,20 +37,20 @@
#define R_REPEAT 200000 #define R_REPEAT 200000
#endif #endif
#define W(w, x) (x & (uint##w##_t)~0) #define W(w, x) (uint##w##_t)((x) & (uint##w##_t)~0)
#define CK_PR_CAS_T(w, v, c, s) \ #define CK_PR_CAS_T(w, v, c, s) \
{ \ { \
uint##w##_t t = v; \ uint##w##_t t = v; \
bool r; \ bool r; \
r = ck_pr_cas_##w(&t, c, s); \ r = ck_pr_cas_##w(&t, c, s); \
if (((c == v) && (r == false)) || ((c != v) && (r == true)) || \ if (((c == v) && (r == false)) || ((c != v) && (r == true)) || \
((r == true) && (W(w, s) != t))) { \ ((r == true) && (W(w, s) != t))) { \
printf("FAIL ["); \ printf("FAIL ["); \
printf("%" PRIu##w " (%" PRIu##w " -> %" PRIu##w ")" \ printf("%" PRIu##w " (%" PRIu##w " -> %" PRIu##w ")" \
" -> %" PRIu##w "]\n", \ " -> %" PRIu##w "]\n", \
(uint##w##_t)v, c, W(w, s), t); \ (uint##w##_t)(v), (uint##w##_t)(c), W(w, s), (uint##w##_t)(t)); \
} \ } \
} }
#define CK_PR_CAS_B(w) \ #define CK_PR_CAS_B(w) \
@ -75,7 +75,7 @@
ck_pr_cas_##w((uint##w##_t *)&t, (uint##w##_t)t, 0); \ ck_pr_cas_##w((uint##w##_t *)&t, (uint##w##_t)t, 0); \
if (t != r) { \ if (t != r) { \
printf("FAIL [%#" PRIx##m " != %#" PRIx##m "]\n", \ printf("FAIL [%#" PRIx##m " != %#" PRIx##m "]\n", \
t, r); \ (uint##m##_t)t, (uint##m##_t)r); \
} \ } \
} }

Loading…
Cancel
Save