lib/libc/quad/ashrdi3.c
quad_t
__ashrdi3(quad_t a, qshift_t shift)
{
	union uu aa;

	aa.q = a;
	if (shift >= LONG_BITS) {
		long s;

		/*
		 * Smear bits rightward using the machine's right-shift
		 * method, whether that is sign extension or zero fill,
		 * to get the `sign word' s.  Note that shifting by
		 * LONG_BITS is undefined, so we shift (LONG_BITS-1),
		 * then 1 more, to get our answer.
		 */
		s = (aa.sl[H] >> (LONG_BITS - 1)) >> 1;
		aa.ul[L] = shift >= QUAD_BITS ? s :
		    aa.sl[H] >> (shift - LONG_BITS);
		aa.ul[H] = s;
	} else if (shift > 0) {
		aa.ul[L] = (aa.ul[L] >> shift) |
		    (aa.ul[H] << (LONG_BITS - shift));
		aa.sl[H] >>= shift;
	}
	return (aa.q);
}
/*
 * Shift a (signed) quad value right (arithmetic shift right).
 */
Shift a (signed) quad value right (arithmetic shift right).
Shift a ( signed ) quad value right ( arithmetic shift right ) .
quad_t
__ashrdi3(quad_t a, qshift_t shift)
{
	union uu aa;
	aa.q = a;
	if (shift >= LONG_BITS) {
		long s;
		s = (aa.sl[H] >> (LONG_BITS - 1)) >> 1;
		aa.ul[L] = shift >= QUAD_BITS ? s :
		    aa.sl[H] >> (shift - LONG_BITS);
		aa.ul[H] = s;
	} else if (shift > 0) {
		aa.ul[L] = (aa.ul[L] >> shift) |
		    (aa.ul[H] << (LONG_BITS - shift));
		aa.sl[H] >>= shift;
	}
	return (aa.q);
}
quad_t __ashrdi3 ( quad_t a , qshift_t shift ) { union uu aa ; aa . q = a ; if ( shift >= LONG_BITS ) { long s ; s = ( aa . sl [ H ] >> ( LONG_BITS - 1 ) ) >> 1 ; aa . ul [ L ] = shift >= QUAD_BITS ? s : aa . sl [ H ] >> ( shift - LONG_BITS ) ; aa . ul [ H ] = s ; } else if ( shift > 0 ) { aa . ul [ L ] = ( aa . ul [ L ] >> shift ) | ( aa . ul [ H ] << ( LONG_BITS - shift ) ) ; aa . sl [ H ] >>= shift ; } return ( aa . q ) ; }
Shift a (signed) quad value right (arithmetic shift right).
Shift a ( signed ) quad value right ( arithmetic shift right ) .
/*
		 * Smear bits rightward using the machine's right-shift
		 * method, whether that is sign extension or zero fill,
		 * to get the `sign word' s.  Note that shifting by
		 * LONG_BITS is undefined, so we shift (LONG_BITS-1),
		 * then 1 more, to get our answer.
		 */