/*
* U32TO8_BIG(c, v) stores the 32-bit-value v in big-endian convention
* into the unsigned char array pointed to by c.
*/
#define U32TO8_BIG(c, v) do { \
u32 x = (v); \
u8 *d = (c); \
d[0] = T8(x >> 24); \
d[1] = T8(x >> 16); \
d[2] = T8(x >> 8); \
d[3] = T8(x); \
} while (0)
/*
* U32TO8_LITTLE(c, v) stores the 32-bit-value v in little-endian convention
* into the unsigned char array pointed to by c.
*/
#define U32TO8_LITTLE(c, v) do { \
u32 x = (v); \
u8 *d = (c); \
d[0] = T8(x); \
d[1] = T8(x >> 8); \
d[2] = T8(x >> 16); \
d[3] = T8(x >> 24); \
} while (0)
Saturday, October 24, 2009
U32-to-U8 conversion
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment