Node:Operations for Integer and Ordinal Types, Next:Complex Number Operations, Previous:Memory Management Routines, Up:Library Routines
shl and
shr exist in GPC as well as bitwise and, or,
xor and not for integer values.
2#100101 and (1 shl 5) = 2#100000
GPC also supports and, or, xor and not
as procedures:
program BitOperatorProcedureDemo;
var x: Integer;
begin
x := 7;
and (x, 14); { sets x to 6 }
xor (x, 3); { sets x to 5 }
end.
Succ and Pred exist in GPC and
accept a second parameter.
Inc and Dec exist in GPC.
program IncDecDemo;
var
i: Integer;
c: Char;
begin
Inc (i); { i := i + 1; }
Dec (i, 7); { i := i - 7; }
Inc (c, 3); { c := Succ (c, 3); }
end.
Min, Max:
These are a GNU Pascal extension and work for reals as well as for
ordinal types. Mixing reals and integers is okay, the result is real
then.