-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37d7808
commit eec2b8b
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef __VDSO_MATH64_H | ||
#define __VDSO_MATH64_H | ||
|
||
static __always_inline u32 | ||
__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) | ||
{ | ||
u32 ret = 0; | ||
|
||
while (dividend >= divisor) { | ||
/* The following asm() prevents the compiler from | ||
optimising this loop into a modulo operation. */ | ||
asm("" : "+rm"(dividend)); | ||
|
||
dividend -= divisor; | ||
ret++; | ||
} | ||
|
||
*remainder = dividend; | ||
|
||
return ret; | ||
} | ||
|
||
#endif /* __VDSO_MATH64_H */ |