8 static void *(*volatile pmemcpy
)(void *restrict
, const void *restrict
, size_t);
10 static void *aligned(void *p
) {
11 return (void*)(((uintptr_t)p
+ 63) & -64);
15 static void test_align(int dalign
, int salign
, int len
)
17 char *src
= aligned(buf
);
18 char *dst
= aligned(buf
+ 128);
19 char *want
= aligned(buf
+ 256);
23 if (salign
+ len
> N
|| dalign
+ len
> N
)
25 for (i
= 0; i
< N
; i
++) {
27 dst
[i
] = want
[i
] = ' ';
29 for (i
= 0; i
< len
; i
++)
30 src
[salign
+i
] = want
[dalign
+i
] = '0'+i
;
31 p
= pmemcpy(dst
+dalign
, src
+salign
, len
);
33 t_error("memcpy(%p,...) returned %p\n", dst
+dalign
, p
);
34 for (i
= 0; i
< N
; i
++)
35 if (dst
[i
] != want
[i
]) {
36 t_error("memcpy(align %d, align %d, %d) failed\n", dalign
, salign
, len
);
37 t_printf("got : %.*s\n", dalign
+len
+1, dst
);
38 t_printf("want: %.*s\n", dalign
+len
+1, want
);
49 for (i
= 0; i
< 16; i
++)
50 for (j
= 0; j
< 16; j
++)
51 for (k
= 0; k
< 64; k
++)