And

From Free Pascal wiki
Revision as of 21:59, 25 October 2007 by Djzepi (talk | contribs)
Jump to navigationJump to search

And produces a value of true if and only if both of its operands are true.

Bitwise operation

Bitwise and sets a bit to 1 if and only if all of the corresponding bits in its operands are 1.

Clear a bit

<delphi> function ClearBit(const AValue, ABitNumber:integer):integer; begin

  result := AValue and not(1 shl ABitNumber);

end; </delphi> If you call ClearBit(%1111,1) then get %1101 (%1111 = 15 and %1101 = 13). If you call ClearBit(13,2) then get 9 (9 = %1001) .

Read more