Node:shr, Next:Sin, Previous:ShortWord, Up:Reference
operator shr (operand1, operand2: integer_type) = Result: integer_type;or
procedure shr (var operand1: integer_type; operand2: integer_type);
In GNU Pascal, shr
has two built-in meanings:
operand1
is shifted right by
operand2
; the result is stored in operand1
.
shr
is a Borland Pascal extension.
Unlike the Borland compilers, GNU Pascal cares about the signedness of the first operand: If a signed integer with a negative value is shifted right, "one" bits are filled in from the left.
Use of shr
as a "procedure" is a GNU Pascal extension.
program ShrDemo; var a: Integer; begin a := 1024 shr 4; { yields 64 } a := -127 shr 4; { yields -8 } shr (a, 2) { same as `a := a shr 2' } end.