请教如下C语言代码的意思
typedef union
{
TYPE value;
struct
{
unsigned int lsw;
unsigned int msw;
} parts;
} ieee_double_shape_type;
/* Get the more significant 32 bit int from a double. */
#define GET_HIGH_WORD(i,d) \
do { \
ieee_double_shape_type gh_u; \
gh_u.value = (d); \
(i) = gh_u.parts.msw; \
} while (0)
/* Set the less significant 32 bits of a double from an int. */
#define SET_LOW_WORD(d,v) \
do { \
ieee_double_shape_type sl_u; \
sl_u.value = (d); \
sl_u.parts.lsw = (v); \
(d) = sl_u.value; \
} while (0)
用的时候:
TYPE __kernel_sin(TYPE x, TYPE y, int iy)
{
TYPE z,r,v;
int ix;
GET_HIGH_WORD(ix,x);
ix = ix & 0x7fffffff; /* high word of x */
if(ix<0x3e400000) /* |x| < 2**-27 */
{if(x==0) return x;} /* generate inexact */
z = x*x;
v = z*x;
r = S2+z*(S3+z*(S4+z*(S5+z*S6)));
if(iy==0) return x+v*(S1+z*r);
else return x-((z*(half*y-v*r)-y)-v*S1);
}
不知道为什么非要用union和struct?
高手能否告诉我不用union和struct,来实现以上功能,谢谢了!