在C语言中,您可以有一个128位的位域吗? [英] In C, can you have a 128-bit bitfield
本文介绍了在C语言中,您可以有一个128位的位域吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码合法吗?
struct BigInt {
uint64_t a : 128;
};
推荐答案
位字段必须位于单个int
中,因此除非您的平台上int
是128位,否则您很不走运.
A bitfield must fit within a single int
, so you're out of luck unless int
is 128 bits on your platform.
(在编辑之前,您在struct
的结尾处也缺少了;
.)
(You were also missing a ;
at the end of the struct
prior to the edit.)
这篇关于在C语言中,您可以有一个128位的位域吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文