[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 9.254 shr

### Synopsis

    operator shr (operand1, operand2: integer type) = Result: integer type;

or

    procedure shr (var operand1: integer type; operand2: integer type);

### Description

In GNU Pascal, ``shr'` has two built-in meanings:

1. Bitwise shift right of an integer-type expression by another integer value. The result is of the type of the first operand.

2. Use as a "procedure": ``operand1'` is shifted right by ``operand2'`; the result is stored in ``operand1'`.

### Conforming to

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

### Example

    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.

### See also

section 9.248 shl, section 8.3 Operators.

This document was generated by Frank Heckenbach on May, 10 2002 using texi2html