1 #ifndef __ASM_PARISC_DIV64
2 #define __ASM_PARISC_DIV64
7 * Copyright (C) 1999 Hewlett-Packard Co
8 * Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com>
10 * vsprintf uses this to divide a 64-bit integer N by a small integer BASE.
11 * This is incredibly hard on IA-64 and HPPA
14 #define do_div(n,base) \
17 _res = ((unsigned long) (n)) % (unsigned) (base); \
18 (n) = ((unsigned long) (n)) / (unsigned) (base); \
24 * unsigned long long division. Yuck Yuck! What is Linux coming to?
25 * This is 100% disgusting
27 #define do_div(n,base) \
29 unsigned long __low, __low2, __high, __rem; \
30 __low = (n) & 0xffffffff; \
33 __rem = __high % (unsigned long)base; \
34 __high = __high / (unsigned long)base; \
35 __low2 = __low >> 16; \
36 __low2 += __rem << 16; \
37 __rem = __low2 % (unsigned long)base; \
38 __low2 = __low2 / (unsigned long)base; \
39 __low = __low & 0xffff; \
40 __low += __rem << 16; \
41 __rem = __low % (unsigned long)base; \
42 __low = __low / (unsigned long)base; \
43 n = __low + ((long long)__low2 << 16) + \
44 ((long long) __high << 32); \
46 __rem = __low % (unsigned long)base; \
47 n = (__low / (unsigned long)base); \