divmoddi4.c (84deca4d8ca2e188b233a45d503443b17088c788) | divmoddi4.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 --- 30 unchanged lines hidden (view full) --- 39 * Divide two signed quads. 40 */ 41quad_t 42__divmoddi4(quad_t a, quad_t b, quad_t *rem) 43{ 44 u_quad_t ua, ub, uq, urem; 45 int negq, negr; 46 | 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 --- 30 unchanged lines hidden (view full) --- 39 * Divide two signed quads. 40 */ 41quad_t 42__divmoddi4(quad_t a, quad_t b, quad_t *rem) 43{ 44 u_quad_t ua, ub, uq, urem; 45 int negq, negr; 46 |
47 if (a < 0) 48 ua = -(u_quad_t)a, negq = 1, negr = 1; 49 else 50 ua = a, negq = 0, negr = 0; 51 if (b < 0) 52 ub = -(u_quad_t)b, negq ^= 1; 53 else | 47 if (a < 0) { 48 ua = -(u_quad_t)a; 49 negq = 1; 50 negr = 1; 51 } else { 52 ua = a; 53 negq = 0; 54 negr = 0; 55 } 56 if (b < 0) { 57 ub = -(u_quad_t)b; 58 negq ^= 1; 59 } else |
54 ub = b; 55 uq = __qdivrem(ua, ub, &urem); 56 if (rem != 0) 57 *rem = negr ? -urem : urem; 58 return (negq ? -uq : uq); 59} | 60 ub = b; 61 uq = __qdivrem(ua, ub, &urem); 62 if (rem != 0) 63 *rem = negr ? -urem : urem; 64 return (negq ? -uq : uq); 65} |