test_arraycopy_func: Use CAST_TO_FN_PTR() rather than directly casting arraycopy_fn

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
Jeremy Huddleston Sequoia 2020-03-31 09:43:11 -07:00
parent 1f1770dacd
commit 7ee657d10e

View File

@ -247,18 +247,21 @@ static void test_arraycopy_func(address func, int alignment) {
// Use middle of array to check that memory before it is not modified.
address buffer = align_up((address)&lbuffer[4], BytesPerLong);
address buffer2 = align_up((address)&lbuffer2[4], BytesPerLong);
arraycopy_fn copyfunc = CAST_TO_FN_PTR(arraycopy_fn, func);
// do an aligned copy
((arraycopy_fn)func)(buffer, buffer2, 0);
copyfunc(buffer, buffer2, 0);
for (i = 0; i < sizeof(lbuffer); i++) {
assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything");
}
// adjust destination alignment
((arraycopy_fn)func)(buffer, buffer2 + alignment, 0);
copyfunc(buffer, buffer2 + alignment, 0);
for (i = 0; i < sizeof(lbuffer); i++) {
assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything");
}
// adjust source alignment
((arraycopy_fn)func)(buffer + alignment, buffer2, 0);
copyfunc(buffer + alignment, buffer2, 0);
for (i = 0; i < sizeof(lbuffer); i++) {
assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything");
}