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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Functions and Subroutines<br />

12.3.56 Binary Pattern Processing Functions: Change Bit<br />

Definition:<br />

Name:<br />

Change bit - Return a1 with a2’th bit complemented.<br />

Usage:<br />

IBCHNG (generic) I ←IBCHNG(I,I), I1 ←IBCHNG(I1,I1), I2 ←IBCHNG(I2,I2)<br />

IBCHNG<br />

I1IBCHNG<br />

I2IBCHNG<br />

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

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

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

12.3.57 Binary Pattern Processing Functions: Arithmetic Shifts<br />

Definition:<br />

Name:<br />

LSHIFT (generic)<br />

LSHIFT<br />

I1LSHIFT<br />

I2LSHIFT<br />

Definition:<br />

Name:<br />

RSHIFT (generic)<br />

RSHIFT<br />

I1RSHIFT<br />

I2RSHIFT<br />

lshift(j,n) Arithmetic left shift<br />

Usage:<br />

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

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

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

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

rshift(j,n) Arithmetic right shift<br />

Usage:<br />

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

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

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

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

Notes:<br />

With these shift functions, n must be a non-negative integer. In an arithmetic shift, j<br />

is considered a signed integer. In the case of a left shift, zeros are shifted into the<br />

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

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

right are lost.<br />

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

These functions are compiled as in-line code unless they are passed as arguments.<br />

Intrinsic Functions 269

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

Saved successfully!

Ooh no, something went wrong!