Lines Matching +full:fraction +full:- +full:z

1 // SPDX-License-Identifier: GPL-2.0
5 * Based on former do_div() implementation from asm-parisc/div64.h:
6 * Copyright (C) 1999 Hewlett-Packard Co
7 * Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com>
16 * for some CPUs. __div64_32() can be overridden by linking arch-specific
44 rem -= (uint64_t) (high*base) << 32; in __div64_32()
54 rem -= b; in __div64_32()
73 quotient = div_u64_rem(-dividend, abs(divisor), (u32 *)remainder); in div_s64_rem()
74 *remainder = -*remainder; in div_s64_rem()
76 quotient = -quotient; in div_s64_rem()
80 quotient = -quotient; in div_s64_rem()
88 * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
113 quot--; in div64_u64_rem()
115 *remainder = dividend - quot * divisor; in div64_u64_rem()
118 *remainder -= divisor; in div64_u64_rem()
128 * div64_u64 - unsigned 64bit divide with 64bit divisor
151 quot--; in div64_u64()
152 if ((dividend - quot * divisor) >= divisor) in div64_u64()
169 return (quot ^ t) - t; in div64_s64()
202 u64 x, y, z; in mul_u64_u64_div_u64() local
206 z = (u64)a_hi * b_hi + (u32)(y >> 32); in mul_u64_u64_div_u64()
208 z += (u32)(y >> 32); in mul_u64_u64_div_u64()
211 u64 n_lo = x, n_hi = z; in mul_u64_u64_div_u64()
217 #pragma GCC diagnostic ignored "-Wdiv-by-zero" in mul_u64_u64_div_u64()
224 /* try reducing the fraction in case the dividend becomes <= 64 bits */ in mul_u64_u64_div_u64()
226 u64 n = shift ? (n_lo >> shift) | (n_hi << (64 - shift)) : n_lo; in mul_u64_u64_div_u64()
232 * rem = (rem << shift) + (n_lo - (n << shift)); in mul_u64_u64_div_u64()
238 return -1; in mul_u64_u64_div_u64()
255 p -= shift; in mul_u64_u64_div_u64()
257 n_hi |= n_lo >> (64 - shift); in mul_u64_u64_div_u64()
260 n_hi -= c; in mul_u64_u64_div_u64()