repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2008-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[official-gcc.git]
/
gcc
/
config
/
udivmodsi4.c
blob
83c2340c2f8b4f3dd74b263a81278d9dc4c226bc
1
unsigned long
2
udivmodsi4
(
unsigned long
num
,
unsigned long
den
,
int
modwanted
)
3
{
4
unsigned long
bit
=
1
;
5
unsigned long
res
=
0
;
6
7
while
(
den
<
num
&&
bit
&& !(
den
& (
1L
<<
31
)))
8
{
9
den
<<=
1
;
10
bit
<<=
1
;
11
}
12
while
(
bit
)
13
{
14
if
(
num
>=
den
)
15
{
16
num
-=
den
;
17
res
|=
bit
;
18
}
19
bit
>>=
1
;
20
den
>>=
1
;
21
}
22
if
(
modwanted
)
return
num
;
23
return
res
;
24
}