C+ C NAME: C Bit4to2 C PURPOSE: C Copy the two least signficant bytes of an integer*4 into C an integer*2 variable. C CALLING SEQUENCE: subroutine Bit4to2(I4,I2) C INPUTS: C I4 integer*4 any integer*4 C OUTPUTS: C I2 integer*2 result in range [-32768,32767] C CALLS: C (none) C PROCEDURE: C iand(I4,Z'7FFF') copies the least significant 15 bits C iand(I4,Z'FFFF')/Z'8000'=0/1 is the 16 bit C iand(I4,Z'FFFF')/Z'8000')*Z'8000' sets the sign bit of the integer*2 C MODIFICATION HISTORY: C SEP-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer*4 I4 integer*2 I2 I2 = iand(I4,Z'7FFF')-iand(I4,Z'FFFF')/Z'8000'*Z'8000' return end