Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98021
b: refs/heads/master
c: d5e181f
h: refs/heads/master
i:
  98019: 942cf3e
v: v3
  • Loading branch information
Jeremy Fitzhardinge authored and Ingo Molnar committed Jun 12, 2008
1 parent 7dd4a7f commit ccf03fb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f595ec964daf7f99668039d7303ddedd09a75142
refs/heads/master: d5e181f78ac753893eb930868a52a4488cd3de0a
19 changes: 19 additions & 0 deletions trunk/include/linux/math64.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,23 @@ static inline s64 div_s64(s64 dividend, s32 divisor)

u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder);

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 /* _LINUX_MATH64_H */
15 changes: 1 addition & 14 deletions trunk/lib/div64.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,6 @@ EXPORT_SYMBOL(div64_u64);
*/
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;
return __iter_div_u64_rem(dividend, divisor, remainder);
}
EXPORT_SYMBOL(iter_div_u64_rem);

0 comments on commit ccf03fb

Please sign in to comment.