在查看QEMU的源代码包时,我在exec.c文件中找到了:
struct PhysPageEntry {
/* How many bits skip to next level (in units of L2_SIZE). 0 for a leaf. */
uint32_t skip : 6;
/* index into phys_sections (!skip) or phys_map_nodes (skip) */
uint32_t ptr : 26;
};
我想知道:运算符的含义。我在C的语法定义列表中找不到它。
这是一个用位字段声明的结构,该结构成员称为位字段:用结构声明设置位字段,该结构声明标记每个字段并确定其宽度。上述定义引起PhysPageEntry
包含一个6位字段和一个26
位域成员即skip
和ptr
分别。它的签名是
struct
{
type [member_name] : width ;
};
这里宽度是在比特字段的比特数。该宽度必须小于或等于指定类型的位宽度。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句