X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=images%2Fmath.h;h=b322949ddbaa5e4529021da583f647c49b8726b3;hb=1481eca416a467e9952dbc5e4852afe66eaf1256;hp=a4d561670274f7a282eebd350b1acce85d604ba1;hpb=bf5edbdd5b56a0d2e239e96dd476c7a9a562506a;p=libucw.git diff --git a/images/math.h b/images/math.h index a4d56167..b322949d 100644 --- a/images/math.h +++ b/images/math.h @@ -1,25 +1,27 @@ #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 uint isqr(int x) { return x * x; } -static inline uns -fast_div_u32_u8(uns x, uns y) +static inline uint fast_div_u32_u8(uint x, uint y) { return ((u64)(x) * fast_div_tab[y]) >> 32; } -static inline uns -fast_sqrt_u16(uns x) +static inline uint fast_sqrt_u16(uint x) { - uns y; + uint y; if (x < (1 << 10) - 3) y = fast_sqrt_tab[(x + 3) >> 2] >> 3; else if (x < (1 << 14) - 28) @@ -29,10 +31,9 @@ fast_sqrt_u16(uns x) return (x < y * y) ? y - 1 : y; } -static inline uns -fast_sqrt_u32(uns x) +static inline uint fast_sqrt_u32(uint x) { - uns y; + uint y; if (x < (1 << 16)) { if (x < (1 << 10) - 3)