So i was trying to do an array operation that looked something like
for (int i=0;i++i<32)
{
output[offset+i] += input[i];
}
where output
and input
are float
arrays (which are 16-byte aligned thanks to malloc
). However, I can't gurantee that offset%4=0
. I was wondering how you could fix these alignment problems.
I though something like
while (offset+c %4 != 0)
{
c++;
output[offset+c] += input[c];
}
followed by an aligned loop - obviously this can't work as we now need an unaligned access to input
.
Is there a way to vectorize my original loop?