404c0dc9fdab997c57e8d350259a8cc12211e2c2
* Copyright (c) 1992 The Regents of the University of California.
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
* %sccs.include.redist.c%
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)ashrdi3.c 5.6 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
* Shift a (signed) quad value right (arithmetic shift right).
__ashrdi3(quad a
, qshift_t shift
)
if (shift
>= LONG_BITS
) {
* 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
[L
] = (aa
.ul
[L
] >> shift
) |
(aa
.ul
[H
] << (LONG_BITS
- shift
));