I use intrinsics so I need to use memory alignment. By this reason I always code like:
float* data = (float*) _mm_malloc(sizeof(float)*3, 64);
But in some cases I have arrays with mixed content. So some parts are aligned and some not.
I tried to use simple test data%64 == 0
but compiler throws error: expression must have integral type
. Operation modulo is not supported for pointers.
Is it possible to implement function which works like this:
// prototype
int testAlignment(void *pointer, int alignment);
float* data = (float*) _mm_malloc(sizeof(float)*3, 64);
testAlignment(data, 64); // true
testAlignment(data + 1, 64); // false