有关结构的基本问题 [英] Basic Question regarding structs

查看:122
本文介绍了有关结构的基本问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过Windows设备驱动程序,并且看到了这样的结构代码:

I am going through a windows device driver and I saw struct code like this:

struct driver1
{
       UINT64 Readable     : 1; 
       UINT64 Writable     : 1; 
       UINT64 Executable   : 1; 
       UINT64 Control      : 3; 
       UINT64 Status       : 1; 
       UINT64 Reserved     : 51; 
       UINT64 Available1   : 5; 
       UINT64 IsMapped     : 1;
};

每个UINT64代表一个位吗?冒号代表位吗?

Does each UINT64 represent a single bit ? Does a colon represent bits?

推荐答案

这意味着ReadableWritableExecutable各自占一点,Control占3,Reserved 51等.

This means that Readable, Writable and Executable each take up a bit, Control takes 3, Reserved 51 and so on.

请参阅 http://publications.gbdirect.co.uk/c_book/第6章/bitfields.html 了解更多信息.

UINT64只是意味着整个位域将位于64位无符号整数内.

The UINT64 simply means that the entire bitfield will be inside a 64 bit unsigned integer.

这篇关于有关结构的基本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆