[vox-tech] wierd u_int32
Brian Lavender
brian at brie.com
Mon Jun 28 21:44:53 PDT 2010
I have some code that has the following snippet, but it has this
u_int32. What the heck is u_int32?
brian
/*
Courtesy of http://ettercap.sourceforge.net/
*/
#ifndef CFG_LITTLE_ENDIAN
#define ptohs(x) ( (u_int16_t) \
((u_int16_t)*((u_int8_t *)x+1)<<8| \
(u_int16_t)*((u_int8_t *)x+0)<<0) \
)
#define ptohl(x) ( (u_int32)*((u_int8_t *)x+3)<<24| \
(u_int32)*((u_int8_t *)x+2)<<16| \
(u_int32)*((u_int8_t *)x+1)<<8| \
(u_int32)*((u_int8_t *)x+0)<<0 \
)
#else
#define ptohs(x) *(u_int16_t *)(x)
#define ptohl(x) *(u_int32 *)(x)
#endif
--
Brian Lavender
http://www.brie.com/brian/
"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."
Professor C. A. R. Hoare
The 1980 Turing award lecture
More information about the vox-tech
mailing list