__declspec(align(16))用于btr [英] __declspec(align(16)) for btr
本文介绍了__declspec(align(16))用于btr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在sse2中进行操作之前,如何对齐btr
数据?请参见下面的代码段
how do i align the btr
data before manupulations in sse2? see code snippet below
//.h file
Class tom
{
Public:
virtual void add(void* btr);
.
.
.
}
// .cpp file
void tom::add(void* btr)
{
int* b = (int *)btr;
}
推荐答案
btr
是否对齐并不重要,重要的是它所指向的缓冲区是否对齐(即btr
内部的地址应对齐).之后,使用以下语句:
It doesn''t matter ifbtr
is not aligned, what is important is that the buffer pointed by it is aligned (i.e. the address insidebtr
should be aligned). After that use the statement:
__declspec(aligned(16)) int *b = (int *)btr;
这篇关于__declspec(align(16))用于btr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文