lshrdi3.c (348238dbd42306d9fb5d89ab393b840572cfeb0f) lshrdi3.c (4a8dea8cf97aab33f4e6a11afcc64dd9562f3bfd)
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This software was developed by the Computer Systems Engineering group
6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7 * contributed to Berkeley.
8 *

--- 26 unchanged lines hidden (view full) ---

35__FBSDID("$FreeBSD$");
36
37#include <libkern/quad.h>
38
39/*
40 * Shift an (unsigned) quad value right (logical shift right).
41 */
42quad_t
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This software was developed by the Computer Systems Engineering group
6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7 * contributed to Berkeley.
8 *

--- 26 unchanged lines hidden (view full) ---

35__FBSDID("$FreeBSD$");
36
37#include <libkern/quad.h>
38
39/*
40 * Shift an (unsigned) quad value right (logical shift right).
41 */
42quad_t
43__lshrdi3(a, shift)
44 quad_t a;
45 qshift_t shift;
43__lshrdi3(quad_t a, qshift_t shift)
46{
47 union uu aa;
48
49 aa.q = a;
50 if (shift >= LONG_BITS) {
51 aa.ul[L] = shift >= QUAD_BITS ? 0 :
52 aa.ul[H] >> (shift - LONG_BITS);
53 aa.ul[H] = 0;
54 } else if (shift > 0) {
55 aa.ul[L] = (aa.ul[L] >> shift) |
56 (aa.ul[H] << (LONG_BITS - shift));
57 aa.ul[H] >>= shift;
58 }
59 return (aa.q);
60}
44{
45 union uu aa;
46
47 aa.q = a;
48 if (shift >= LONG_BITS) {
49 aa.ul[L] = shift >= QUAD_BITS ? 0 :
50 aa.ul[H] >> (shift - LONG_BITS);
51 aa.ul[H] = 0;
52 } else if (shift > 0) {
53 aa.ul[L] = (aa.ul[L] >> shift) |
54 (aa.ul[H] << (LONG_BITS - shift));
55 aa.ul[H] >>= shift;
56 }
57 return (aa.q);
58}