Delphi中取某整数的某位的位状态的小函数

Delphi教程 2025-08-15

type

TPosRange=0..32;

TStateResult=0..1;

function GetBitSate(Source:Integer;Pos:TPosRange):TStateResult;

begin

Result:=((Source and (1 shl Pos))shr Pos);

end;