2.9BSD/usr/src/lib/libF77/h_ishft.c

/*ISHFT fortran callable.    PLW 8/7/79.*/
/* For integer x shift by amount y.
   y >0 shift left, right fill with 0
   y =0 no shift
   y <0 shift right, left fill with 0's even if sign
        bit is on                                   */
int h_ishft(x,y)
	int *x,*y;
{
	if (*y > 0)
		return (*x << *y);
	else if (*y < 0)
		return ((*x >>(-*y)) & (~(~0 << (16 + *y))));
	else
		return (*x);
}