X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=images%2Fmath.h;h=ecbecbf5ffb74705b288bfa7b133ae7ae384914f;hb=77c84c65dc22afe21bc52d95cd3996b8e1c7d065;hp=1824c95bb42a7a05361defc282487e32aa7574a3;hpb=487f19b958da5875f0c05e53d5c229874662735e;p=libucw.git diff --git a/images/math.h b/images/math.h index 1824c95b..ecbecbf5 100644 --- a/images/math.h +++ b/images/math.h @@ -1,33 +1,25 @@ #ifndef _IMAGES_MATH_H #define _IMAGES_MATH_H +#ifdef CONFIG_UCW_CLEAN_ABI +#define fast_div_tab ucw_fast_div_tab +#define fast_sqrt_tab ucw_fast_sqrt_tab +#endif + extern const u32 fast_div_tab[]; extern const byte fast_sqrt_tab[]; -static inline uns -isqr(int x) +static inline uns isqr(int x) { return x * x; } -static inline uns -fast_div_u32_u8(uns x, uns y) +static inline uns fast_div_u32_u8(uns x, uns y) { -#ifdef CPU_I386 - int ret, dmy; - asm volatile ( - "mull %3" - :"=d"(ret),"=a"(dmy) - :"1"(x),"g"(fast_div_tab[y]) - ); - return ret; -#else return ((u64)(x) * fast_div_tab[y]) >> 32; -#endif } -static inline uns -fast_sqrt_u16(uns x) +static inline uns fast_sqrt_u16(uns x) { uns y; if (x < (1 << 10) - 3) @@ -39,8 +31,7 @@ fast_sqrt_u16(uns x) return (x < y * y) ? y - 1 : y; } -static inline uns -fast_sqrt_u32(uns x) +static inline uns fast_sqrt_u32(uns x) { uns y; if (x < (1 << 16))