delphi结构中位是怎么定义的?

lms0515032124 2009-12-03 02:44:05
如C中的这种结构怎么定义?
typedef struct aaa{
unsigned short aa:4;
unsigned short bb:4;
};
...全文
123 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
看那山瞧那水 2009-12-07
  • 打赏
  • 举报
回复
有个TBits类,不过功能太少
Use TBits to store and access an indefinite number of boolean values. TBits can store as many of boolean values as can fit in available memory, automatically expanding its storage space as needed. If the number of boolean values is limited to 32, the same functionality can be achieved using a 32-bit integer with the bitwise AND (Delphi) or & (C++) and OR (Delphi) or | (C++) operators.
diruser 2009-12-07
  • 打赏
  • 举报
回复
同意楼上的方式!
haitao 2009-12-03
  • 打赏
  • 举报
回复
做成类:
private
Faabb:byte;
property aa:byte read GetAA write SetAA;
property bb:byte read GetBB write SetBB;

使用起来,就方便了
lms0515032124 2009-12-03
  • 打赏
  • 举报
回复
只能取一个字节后做位操作?那样好麻烦...
僵哥 2009-12-03
  • 打赏
  • 举报
回复
无法定义,只能走偏门实现
yumenyoudian 2009-12-03
  • 打赏
  • 举报
回复
aaa = record
aa: byte;
bb: byte;
end;

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧