mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 23:19:26 +02:00

tests o currently not yet integrated in the makefile system, use testall.sh/ testall.bat to run the tests git-svn-id: branches/jvmbackend@18777 -
23 lines
335 B
ObjectPascal
23 lines
335 B
ObjectPascal
program getbit;
|
|
|
|
{$mode delphi}
|
|
|
|
type
|
|
plint = class
|
|
digits: array of byte;
|
|
end;
|
|
|
|
function LGetBit(A: PLInt; Bit: Cardinal): Integer;
|
|
begin
|
|
Result := (A.Digits[(Bit - 1) shr 5 + 1] shr ((Bit - 1) and $1F{(Bit - 1) mod 32})) and 1;
|
|
end;
|
|
|
|
var
|
|
p: plint;
|
|
begin
|
|
p:=plint.create;
|
|
setlength(p.digits,10);
|
|
lgetbit(p,4);
|
|
end.
|
|
|