怎么测试一个BYTE中某一位是1啊?请指点最简单的办法

9551226 2002-08-28 09:36:43
...全文
169 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
chll 2002-08-28
  • 打赏
  • 举报
回复
//取位
function GetBit(X:Byte; Index:Bit):Boolean;
begin
Result:=(X and ( 1 shl Index)) <> 0;
end;
ChinaCom 2002-08-28
  • 打赏
  • 举报
回复
a : Byte;
x : integer;
x := a and 1 ;
if x =1 then
....
else ....




good_student 2002-08-28
  • 打赏
  • 举报
回复
var
a: byte;
i: integer;
begin
for i := 0 to 7 do
if (a shr (7 - i)) and 1 > 0 then
...
keyz 2002-08-28
  • 打赏
  • 举报
回复
a:byte;
x:integer;

if (a and (1 shl x)) <> 0 then ...

5,928

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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