标签: c++ c++11 c++14
我在设计中需要 4位 整数以减少内存使用。在任何版本的 c ++ , c ++ 11 , c ++ 14 中都可以使用任何版本。
答案 0 :(得分:5)
没有本机4位数据类型。但是你可以用一个8位的值来保存高/低nibble中的两个4位值。
答案 1 :(得分:4)
不,但你可以使用:
struct A { unsigned int value1 : 4; unsigned int value2 : 4; };