Difference between revisions of "Shr"

From Lazarus wiki
Jump to navigationJump to search
m (Text replace - "delphi>" to "syntaxhighlight>")
Line 5: Line 5:
 
== Is a bit set ==
 
== Is a bit set ==
  
<delphi>
+
<syntaxhighlight>
 
function isBitSet(AValue, ABitNumber:integer):boolean;
 
function isBitSet(AValue, ABitNumber:integer):boolean;
 
begin
 
begin
 
   result:=odd(AValue shr ABitNumber);
 
   result:=odd(AValue shr ABitNumber);
 
end;
 
end;
</delphi>
+
</syntaxhighlight>
  
 
=== Read more ===
 
=== Read more ===

Revision as of 14:57, 24 March 2012

Shift right (shr) performs a right bit-shift operation (opposite than shl).


Is a bit set

function isBitSet(AValue, ABitNumber:integer):boolean;
begin
   result:=odd(AValue shr ABitNumber);
end;

Read more