short类型的位数
#include<stdio.h>#include<conio.h>
using namespace std;
// 实现了一个复数和旋转因子的相乘操作 yi+yq*j=(xi+xq*j)*(cos-sin*j)
typedef signed short INT16; /* 16 bit signed integer */
typedef struct complex {
INT16 real,imag ;
} complex;
complex ccmul(complex source,complex factor)
{
complex result;
result.real = (source.real)*(factor.real) + (source.imag)*(factor.imag);
result.imag = (source.imag)*(factor.real) - (source.real)*(factor.imag);
return result;
}
void print(complex source)
{
printf("data.real=%x\tdata.imag=%x\n",source.real,source.imag);
}
int main()
{
complex data={0x7233,0xf233};
complex wnp={0x0165,0xeac8};
complex data1={0x7345,0x6332};
complex wnp1={0x2355,0x3244};
complex data2={0x7345,0x6332};
complex wnp2={0x0,0x1};
complex result;
result=ccmul(data2,wnp2);
print(result);
return 0;
}
上面代码运行结果见附件,怎么short也是32位长度的?
[ 本帖最后由 vfdff 于 2007-11-25 10:56 编辑 ]