moddi3.c (84deca4d8ca2e188b233a45d503443b17088c788) moddi3.c (9ac841e922da86d4259add8bf64467f693b4f8aa)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and

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

42 * Return remainder after dividing two signed quads.
43 */
44quad_t
45__moddi3(quad_t a, quad_t b)
46{
47 u_quad_t ua, ub, ur;
48 int neg;
49
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and

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

42 * Return remainder after dividing two signed quads.
43 */
44quad_t
45__moddi3(quad_t a, quad_t b)
46{
47 u_quad_t ua, ub, ur;
48 int neg;
49
50 if (a < 0)
51 ua = -(u_quad_t)a, neg = 1;
52 else
53 ua = a, neg = 0;
50 if (a < 0) {
51 ua = -(u_quad_t)a;
52 neg = 1;
53 } else {
54 ua = a;
55 neg = 0;
56 }
54 if (b < 0)
55 ub = -(u_quad_t)b;
56 else
57 ub = b;
58 (void)__qdivrem(ua, ub, &ur);
59 return (neg ? -ur : ur);
60}
57 if (b < 0)
58 ub = -(u_quad_t)b;
59 else
60 ub = b;
61 (void)__qdivrem(ua, ub, &ur);
62 return (neg ? -ur : ur);
63}