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