6 static void *aligned(void *p
)
8 return (void*)(((uintptr_t)p
+ 63) & -64);
11 static void *aligncpy(void *p
, size_t len
, size_t a
)
13 return memcpy((char*)aligned(buf
)+a
, p
, len
);
18 for (align=0; align<8; align++) { \
19 char *p = aligncpy(s, sizeof s, align); \
20 char *q = strchr(p, c); \
22 t_error("strchr(%s,%s) with align=%d returned str+%d, wanted 0\n", #s, #c, align, q-p); \
26 #define T(s, c, n) { \
28 for (align=0; align<8; align++) { \
29 char *p = aligncpy(s, sizeof s, align); \
30 char *q = strchr(p, c); \
32 t_error("strchr(%s,%s) with align=%d returned 0, wanted str+%d\n", #s, #c, align, n); \
33 else if (q - p != n) \
34 t_error("strchr(%s,%s) with align=%d returned str+%d, wanted str+%d\n", #s, #c, align, q-p, n); \
44 for (i
= 0; i
< 128; i
++)
46 for (i
= 0; i
< 256; i
++)
47 *((unsigned char*)s
+i
) = i
+1;