blob: 3ec1fadcfd7ed60fe771821bb9c497cc198452bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#ifndef _ASM_DIV64_H
#define _ASM_DIV64_H
/*
* Don't use this one in new code
*/
#define do_div64_32(res, high, low, base) ({ \
unsigned int __quot, __mod; \
unsigned long __div; \
unsigned int __low, __high, __base; \
\
__high = (high); \
__low = (low); \
__div = __high; \
__div = __div << 32 | __low; \
__base = (base); \
\
__mod = __div % __base; \
__div = __div / __base; \
\
__quot = __div; \
(res) = __quot; \
__mod; })
/*
* Hey, we're already 64-bit, no
* need to play games..
*/
#define do_div(n, base) ({ \
unsigned long __quot; \
unsigned int __mod; \
unsigned long __div; \
unsigned int __base; \
\
__div = (n); \
__base = (base); \
\
__mod = __div % __base; \
__quot = __div / __base; \
\
(n) = __quot; \
__mod; })
#endif /* _ASM_DIV64_H */
|