Quote Originally Posted by Darkhog View Post
//edit: I wrote (but didn't test) function that would check if specific bit is set. You'll need math unit for that one:
Code:
function IsBitSet(num:integer;bit:byte):Boolean
var bitnum:Integer;
begin
  bitnum:= Trunc(intpower(2,bit);
  Result:= (num and bitnum) = bitnum;
end;
Though it should work fine.
Dan already gave more optimized code for that
Code:
function GetBit(const Value, Bit: LongWord): Boolean;
begin
  Result := Boolean((Value shr Bit) and 1);
end;
Both trunc() and intpower() do a massive amount of extra work.