X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/bffa3430fbbaaad29bec0b5bee9c1f0bfc7fd068..34f6af4f61e0eec9c96113e07f140b609b4113c8:/lunaix-os/arch/x86/includes/sys/muldiv64.h diff --git a/lunaix-os/arch/x86/includes/sys/muldiv64.h b/lunaix-os/arch/x86/includes/sys/muldiv64.h deleted file mode 100644 index c575685..0000000 --- a/lunaix-os/arch/x86/includes/sys/muldiv64.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __LUNAIX_MULDIV64_H -#define __LUNAIX_MULDIV64_H - -#include -#include - -#ifdef CONFIG_ARCH_I386 -#define do_udiv64(n, base) \ - ({ \ - unsigned long __upper, __low, __high, __mod, __base; \ - __base = (base); \ - if (__builtin_constant_p(__base) && is_pot(__base)) { \ - __mod = n & (__base - 1); \ - n >>= ilog2(__base); \ - } else { \ - asm("" : "=a"(__low), "=d"(__high) : "A"(n)); \ - __upper = __high; \ - if (__high) { \ - __upper = __high % (__base); \ - __high = __high / (__base); \ - } \ - asm("divl %2" \ - : "=a"(__low), "=d"(__mod) \ - : "rm"(__base), "0"(__low), "1"(__upper)); \ - asm("" : "=A"(n) : "a"(__low), "d"(__high)); \ - } \ - __mod; \ - }) -#else - #define do_udiv64(n, base) \ - ({ \ - n = (n) / (base); \ - (n) % (base); \ - }) -#endif - -static inline u64_t -udiv64(u64_t n, unsigned int base) -{ - do_udiv64(n, base); - - return n; -} - -static inline unsigned int -umod64(u64_t n, unsigned int base) -{ - return do_udiv64(n, base); -} - -#endif /* __LUNAIX_MULDIV64_H */