[C] 纯文本查看 复制代码
void my_neighbors(void** neighbor_addrs,int* num_neigh, targs* args)
{
int starti=args->starti;
int startj=args->startj;
void* src_addr=args->src_addr;
*num_neigh=0;
if(starti - BLKX>=0)
neighbor_addrs[(*num_neigh)++]=(void*)(src_addr - BLKX * SIZEY * SIZEZ * 8);
if(starti + BLKX < SIZEX)
neighbor_addrs[(*num_neigh)++]=(void*)(src_addr + BLKX * SIZEY * SIZEZ * 8);
if(startj - BLKY >= 0)
neighbor_addrs[(*num_neigh)++]=(void*)(src_addr - BLKY * SIZEZ * 8);
if(startj + BLKY < SIZEY)
neighbor_addrs[(*num_neigh)++]=(void*)(src_addr + BLKY * SIZEZ* 8);
}