4 #include <winpr/windows.h>
6 int TestAlignment(
int argc,
char* argv[])
22 ptr = winpr_aligned_malloc(100, alignment);
26 printf(
"Error allocating aligned memory.\n");
30 if (((
size_t)ptr % alignment) != 0)
32 printf(
"This pointer, %p, is not aligned on %" PRIuz
"\n", ptr, alignment);
38 ptr = winpr_aligned_realloc(ptr, 200, alignment);
40 if (((
size_t)ptr % alignment) != 0)
42 printf(
"This pointer, %p, is not aligned on %" PRIuz
"\n", ptr, alignment);
46 winpr_aligned_free(ptr);
50 ptr = winpr_aligned_offset_malloc(200, alignment, offset);
54 printf(
"Error reallocating aligned offset memory.");
58 if (((((
size_t)ptr) + offset) % alignment) != 0)
60 printf(
"This pointer, %p, does not satisfy offset %" PRIuz
" and alignment %" PRIuz
"\n",
61 ptr, offset, alignment);
67 ptr = winpr_aligned_offset_realloc(ptr, 200, alignment, offset);
71 printf(
"Error reallocating aligned offset memory.");
75 if (((((
size_t)ptr) + offset) % alignment) != 0)
77 printf(
"This pointer, %p, does not satisfy offset %" PRIuz
" and alignment %" PRIuz
"\n",
78 ptr, offset, alignment);
84 winpr_aligned_free(ptr);