WIP FPC-III support
[linux/fpc-iii.git] / include / vdso / math64.h
blob7da703ee55614a5fd7a0c7bd826dd034d463662b
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __VDSO_MATH64_H
3 #define __VDSO_MATH64_H
5 static __always_inline u32
6 __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
8 u32 ret = 0;
10 while (dividend >= divisor) {
11 /* The following asm() prevents the compiler from
12 optimising this loop into a modulo operation. */
13 asm("" : "+rm"(dividend));
15 dividend -= divisor;
16 ret++;
19 *remainder = dividend;
21 return ret;
24 #endif /* __VDSO_MATH64_H */