返回信息流比如我定义一个9bit的无符号整型a
有点印象是:
×× a:9;
忘记了。
有人记得吗?
types.h里提到的:
/* For GCC 2.7 and later, we can use specific type-size attributes. */
# define __intN_t(N, MODE) \
typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
# define __u_intN_t(N, MODE) \
typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
# ifndef __int8_t_defined
# define __int8_t_defined
__intN_t (8, __QI__);
__intN_t (16, __HI__);
__intN_t (32, __SI__);
__intN_t (64, __DI__);
# endif
__u_intN_t (8, __QI__);
__u_intN_t (16, __HI__);
__u_intN_t (32, __SI__);
__u_intN_t (64, __DI__);
typedef int register_t __attribute__ ((__mode__ (__word__)));
这个有具体使用的代码吗?
QI,HI,DI,SI分别又是什么意思?
谢谢~~~
这是一条镜像帖。来源:北邮人论坛 / soft-design / #28175同步于 2008/7/17
该镜像源已超过 30 天没有更新,可能在源站已被删除。
SoftDesign机器人发帖
[求助]C语言里如何定义任意bit长度的类型来着?
Hermione
2008/7/17镜像同步3 回复
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
你说的是位域和联合吧。
至于QI,HI,DI,SI,
我觉得I代表的是int,
Q代表quadral
H代表half
S代表single
D代表double
这样的猜测好像不太过分的说。
struct iphdr
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int ihl:4;
unsigned int version:4;
#elif __BYTE_ORDER == __BIG_ENDIAN
unsigned int version:4;
unsigned int ihl:4;
#else
嘿嘿找到了。
原来我用的是unsigned long a:9
编译不通过