moddi3.c (348238dbd42306d9fb5d89ab393b840572cfeb0f) moddi3.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 *

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

38
39/*
40 * Return remainder after dividing two signed quads.
41 *
42 * XXX
43 * If -1/2 should produce -1 on this machine, this code is wrong.
44 */
45quad_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 *

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

38
39/*
40 * Return remainder after dividing two signed quads.
41 *
42 * XXX
43 * If -1/2 should produce -1 on this machine, this code is wrong.
44 */
45quad_t
46__moddi3(a, b)
47 quad_t a, b;
46__moddi3(quad_t a, quad_t b)
48{
49 u_quad_t ua, ub, ur;
50 int neg;
51
52 if (a < 0)
53 ua = -(u_quad_t)a, neg = 1;
54 else
55 ua = a, neg = 0;
56 if (b < 0)
57 ub = -(u_quad_t)b;
58 else
59 ub = b;
60 (void)__qdivrem(ua, ub, &ur);
61 return (neg ? -ur : ur);
62}
47{
48 u_quad_t ua, ub, ur;
49 int neg;
50
51 if (a < 0)
52 ua = -(u_quad_t)a, neg = 1;
53 else
54 ua = a, neg = 0;
55 if (b < 0)
56 ub = -(u_quad_t)b;
57 else
58 ub = b;
59 (void)__qdivrem(ua, ub, &ur);
60 return (neg ? -ur : ur);
61}