Commit | Line | Data |
---|---|---|
89a9f6b5 KB |
1 | /*- |
2 | * Copyright (c) 1992 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
6 | */ | |
7 | ||
8 | #if defined(LIBC_SCCS) && !defined(lint) | |
9 | static char sccsid[] = "@(#)udivdi3.c 5.1 (Berkeley) %G%"; | |
10 | #endif /* LIBC_SCCS and not lint */ | |
11 | ||
12 | #include "longlong.h" | |
13 | ||
14 | extern void __bdiv (); | |
15 | ||
16 | long long | |
17 | __udivdi3 (u, v) | |
18 | long long u, v; | |
19 | { | |
20 | unsigned long a[2][2], b[2], q[2], r[2]; | |
21 | long_long w; | |
22 | long_long uu, vv; | |
23 | ||
24 | uu.ll = u; | |
25 | vv.ll = v; | |
26 | ||
27 | a[HIGH][HIGH] = 0; | |
28 | a[HIGH][LOW] = 0; | |
29 | a[LOW][HIGH] = uu.s.high; | |
30 | a[LOW][LOW] = uu.s.low; | |
31 | b[HIGH] = vv.s.high; | |
32 | b[LOW] = vv.s.low; | |
33 | ||
34 | __bdiv (a, b, q, r, sizeof a, sizeof b); | |
35 | ||
36 | w.s.high = q[HIGH]; | |
37 | w.s.low = q[LOW]; | |
38 | return w.ll; | |
39 | } |