24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Language</strong> <strong>Reference</strong><br />

Definition:<br />

Name:<br />

ISHFT (generic)<br />

ISHFT<br />

I1ISHFT<br />

I2ISHFT<br />

Notes:<br />

ishft(j,n) Logical shift<br />

Usage:<br />

I ←ISHFT(I,I), I1 ←ISHFT(I1,I1), I2 ←ISHFT(I2,I2)<br />

I ←ISHFT(I,I)<br />

I1 ←I1SHFT(I1,I1)<br />

I2 ←I2SHFT(I2,I2)<br />

There are three shift operations: logical, arithmetic and circular. These shift<br />

operations are implemented as integer functions having two arguments. The first<br />

argument, j, is the value to be shifted and the second argument, n, is the number of<br />

bits to shift. If n is less than 0, a right shift is performed. If n is greater than 0, a left<br />

shift is performed. If n is equal to 0, no shift is performed. Note that the arguments<br />

are not modified.<br />

In a logical shift, bits shifted out from the left or right are lost. Zeros are shifted in<br />

from the opposite end.<br />

In an arithmetic shift, j is considered a signed integer. In the case of a right shift,<br />

zeros are shifted into the left if j is positive and ones if j is negative. Bits shifted out<br />

of the right are lost. In the case of a left shift, zeros are shifted into the right and bits<br />

shifted out of the left are lost.<br />

In a circular shift, bits shifted out one end are shifted into the opposite end. No bits<br />

are lost.<br />

12.3.51 Binary Pattern Processing Functions: Arithmetic Shift<br />

Definition:<br />

Name:<br />

ISHA (generic)<br />

ISHA<br />

I1ISHA<br />

I2ISHA<br />

Notes:<br />

isha(j,n) Arithmetic shift<br />

Usage:<br />

I ←ISHA(I,I), I1 ←ISHA(I1,I1), I2 ←ISHA(I2,I2)<br />

I ←ISHA(I,I)<br />

I1 ←I1SHA(I1,I1)<br />

I2 ←I2SHA(I2,I2)<br />

There are three shift operations: logical, arithmetic and circular. These shift<br />

operations are implemented as integer functions having two arguments. The first<br />

argument, j, is the value to be shifted and the second argument, n, is the number of<br />

bits to shift. If n is less than 0, a right shift is performed. If n is greater than 0, a left<br />

shift is performed. If n is equal to 0, no shift is performed. Note that the arguments<br />

are not modified.<br />

In a logical shift, bits shifted out from the left or right are lost. Zeros are shifted in<br />

from the opposite end.<br />

266 Intrinsic Functions

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!