今天在阅读SPRU198k.pdf 文档时,看到下面函数,我想知道,编译器在编译时遇到
WORD_ALIGNED(xptr);
WORD_ALIGNED(yptr);
函数,自动将传入函数的指针所指地址xptr和yptr四字节对齐,还是在此判断xptr和yptr地址是否是四字节对齐?
#define WORD_ALIGNED(x) (_nassert(((int)(x) & 0x3) == 0))
void lesson3_c(short * restrict xptr, short * restrict yptr, short *zptr,short *w_sum, int N)
{
int i, w_vec1, w_vec2;
short w1,w2;
WORD_ALIGNED(xptr);
WORD_ALIGNED(yptr);
w1 = zptr[0];
w2 = zptr[1];
#pragma MUST_ITERATE(20, , 2);
for (i = 0; i < N; i++)
{
w_vec1 = xptr[i] * w1;
w_vec2 = yptr[i] * w2;
w_sum[i] = (w_vec1+w_vec2) >> 15;
}
}
非常感谢! |