X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/32b9a6d76790c73d3d2d36d9081a2581cc65d184..28c176b668c841a3b7fb093faccf0efa39257603:/lunaix-os/arch/i386/includes/sys/muldiv64.h?ds=sidebyside diff --git a/lunaix-os/arch/i386/includes/sys/muldiv64.h b/lunaix-os/arch/i386/includes/sys/muldiv64.h deleted file mode 100644 index 940f7de..0000000 --- a/lunaix-os/arch/i386/includes/sys/muldiv64.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __LUNAIX_MULDIV64_H -#define __LUNAIX_MULDIV64_H - -#include -#include - -#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; \ - }) - -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 */