And

From Lazarus-ccr

Jump to: navigation, search

English (en) Suomi (fi)

Contents

[edit] Boolean operation

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

[edit] Truth table

A B   A and B  
  false     false     false
  false   true   false
  true   false   false
  true   true   true


[edit] Bitwise operation

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

[edit] Clear a bit

 
function ClearBit(const AValue, ABitNumber:integer):integer;
begin
   result := AValue and not(1 shl ABitNumber);
end;
 

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) .

[edit] Read more