Lines Matching +full:left +full:- +full:shift
27 #include "qemu/host-utils.h"
66 /* Unsigned 64x64 -> 128 multiplication */
72 /* Signed 64x64 -> 128 multiplication */
81 rh -= a; in muls64()
84 rh -= b; in muls64()
90 * Unsigned 128-by-64 division.
113 dhi = (dhi << sh) | (dlo >> (64 - sh)); in divu128()
123 dhighest = dhi >> (64 - sh); in divu128()
124 dhi = (dhi << sh) | (dlo >> (64 - sh)); in divu128()
132 * (dhi - divisor) < divisor in divu128()
138 dhi -= divisor; in divu128()
154 * Signed 128-by-64 division.
169 unsig_hi = -unsig_hi; in divs128()
172 unsig_lo = -unsig_lo; in divs128()
179 divisor = -divisor; in divs128()
186 *phigh = -unsig_hi; in divs128()
190 *plow = -unsig_lo; in divs128()
198 return -rem; in divs128()
206 * urshift - 128-bit Unsigned Right Shift.
207 * @plow: in/out - lower 64-bit integer.
208 * @phigh: in/out - higher 64-bit integer.
209 * @shift: in - bytes to shift, between 0 and 127.
211 * Result is zero-extended and stored in plow/phigh, which are
212 * input/output variables. Shift values outside the range will
214 * verify/assert both the shift range and plow/phigh pointers.
216 void urshift(uint64_t *plow, uint64_t *phigh, int32_t shift) in urshift() argument
218 shift &= 127; in urshift()
219 if (shift == 0) { in urshift()
223 uint64_t h = *phigh >> (shift & 63); in urshift()
224 if (shift >= 64) { in urshift()
228 *plow = (*plow >> (shift & 63)) | (*phigh << (64 - (shift & 63))); in urshift()
234 * ulshift - 128-bit Unsigned Left Shift.
235 * @plow: in/out - lower 64-bit integer.
236 * @phigh: in/out - higher 64-bit integer.
237 * @shift: in - bytes to shift, between 0 and 127.
238 * @overflow: out - true if any 1-bit is shifted out.
240 * Result is zero-extended and stored in plow/phigh, which are
241 * input/output variables. Shift values outside the range will
243 * verify/assert both the shift range and plow/phigh pointers.
245 void ulshift(uint64_t *plow, uint64_t *phigh, int32_t shift, bool *overflow) in ulshift() argument
250 shift &= 127; in ulshift()
251 if (shift == 0) { in ulshift()
256 urshift(&low, &high, 128 - shift); in ulshift()
261 if (shift >= 64) { in ulshift()
262 *phigh = *plow << (shift & 63); in ulshift()
265 *phigh = (*plow >> (64 - (shift & 63))) | (*phigh << (shift & 63)); in ulshift()
266 *plow = *plow << shift; in ulshift()
271 * Unsigned 256-by-128 division.
276 * Adapted from include/qemu/host-utils.h udiv_qrnnd,
277 * from the GNU Multi Precision Library - longlong.h __udiv_qrnnd
333 * Unsigned 256-by-128 division.
357 int128_urshift(dlo, (128 - sh))); in divu256()
367 dhighest = int128_rshift(dhi, (128 - sh)); in divu256()
369 int128_urshift(dlo, (128 - sh))); in divu256()
377 * (dhi - divisor) < divisor in divu256()
400 * Signed 256-by-128 division.