Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 88939
b: refs/heads/master
c: 925a09b
h: refs/heads/master
i:
  88937: f97ae12
  88935: 2e8ec4e
v: v3
  • Loading branch information
Joe Perches authored and Ingo Molnar committed Apr 17, 2008
1 parent 540a8d1 commit c18910b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 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: c1773a167defdec919b1dbfc9100054c44fd0ff5
refs/heads/master: 925a09b27fc73593eb705e50e6db86c4a22091db
35 changes: 18 additions & 17 deletions trunk/include/asm-x86/div64.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@
* This ends up being the most efficient "calling
* convention" on x86.
*/
#define do_div(n,base) ({ \
unsigned long __upper, __low, __high, __mod, __base; \
__base = (base); \
asm("":"=a" (__low), "=d" (__high):"A" (n)); \
__upper = __high; \
if (__high) { \
__upper = __high % (__base); \
__high = __high / (__base); \
} \
asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); \
asm("":"=A" (n):"a" (__low),"d" (__high)); \
__mod; \
#define do_div(n, base) \
({ \
unsigned long __upper, __low, __high, __mod, __base; \
__base = (base); \
asm("":"=a" (__low), "=d" (__high) : "A" (n)); \
__upper = __high; \
if (__high) { \
__upper = __high % (__base); \
__high = __high / (__base); \
} \
asm("divl %2":"=a" (__low), "=d" (__mod) \
: "rm" (__base), "0" (__low), "1" (__upper)); \
asm("":"=A" (n) : "a" (__low), "d" (__high)); \
__mod; \
})

/*
Expand All @@ -37,14 +39,13 @@
*
* Warning, this will do an exception if X overflows.
*/
#define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c)
#define div_long_long_rem(a, b, c) div_ll_X_l_rem(a, b, c)

static inline long
div_ll_X_l_rem(long long divs, long div, long *rem)
static inline long div_ll_X_l_rem(long long divs, long div, long *rem)
{
long dum2;
__asm__("divl %2":"=a"(dum2), "=d"(*rem)
: "rm"(div), "A"(divs));
asm("divl %2":"=a"(dum2), "=d"(*rem)
: "rm"(div), "A"(divs));

return dum2;

Expand Down

0 comments on commit c18910b

Please sign in to comment.