repo.or.cz
/
linux-2.6
/
next.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add port definition for mcf UART driver
[linux-2.6/next.git]
/
arch
/
parisc
/
lib
/
libgcc
/
__udivmoddi4.c
blob
2df0caa5a7d80582daf5fd95f857a30b84dbb1bb
1
#include
"libgcc.h"
2
3
u64
__udivmoddi4
(
u64 num
,
u64 den
,
u64
*
rem_p
)
4
{
5
u64 quot
=
0
,
qbit
=
1
;
6
7
if
(
den
==
0
) {
8
BUG
();
9
}
10
11
/* Left-justify denominator and count shift */
12
while
((
s64
)
den
>=
0
) {
13
den
<<=
1
;
14
qbit
<<=
1
;
15
}
16
17
while
(
qbit
) {
18
if
(
den
<=
num
) {
19
num
-=
den
;
20
quot
+=
qbit
;
21
}
22
den
>>=
1
;
23
qbit
>>=
1
;
24
}
25
26
if
(
rem_p
)
27
*
rem_p
=
num
;
28
29
return
quot
;
30
}
31
EXPORT_SYMBOL
(
__udivmoddi4
);