4 #ifdef CONFIG_UCW_CLEAN_ABI
5 #define fast_div_tab ucw_fast_div_tab
6 #define fast_sqrt_tab ucw_fast_sqrt_tab
9 extern const u32 fast_div_tab[];
10 extern const byte fast_sqrt_tab[];
12 static inline uint isqr(int x)
17 static inline uint fast_div_u32_u8(uint x, uint y)
19 return ((u64)(x) * fast_div_tab[y]) >> 32;
22 static inline uint fast_sqrt_u16(uint x)
25 if (x < (1 << 10) - 3)
26 y = fast_sqrt_tab[(x + 3) >> 2] >> 3;
27 else if (x < (1 << 14) - 28)
28 y = fast_sqrt_tab[(x + 28) >> 6] >> 1;
30 y = fast_sqrt_tab[x >> 8];
31 return (x < y * y) ? y - 1 : y;
34 static inline uint fast_sqrt_u32(uint x)
39 if (x < (1 << 10) - 3)
40 y = fast_sqrt_tab[(x + 3) >> 2] >> 3;
41 else if (x < (1 << 14) - 28)
42 y = fast_sqrt_tab[(x + 28) >> 6] >> 1;
44 y = fast_sqrt_tab[x >> 8];
52 y = fast_sqrt_tab[x >> 12];
53 y = (fast_div_u32_u8(x, y) >> 3) + (y << 1);
57 y = fast_sqrt_tab[x >> 16];
58 y = (fast_div_u32_u8(x, y) >> 5) + (y << 3);
67 y = fast_sqrt_tab[x >> 18];
68 y = (fast_div_u32_u8(x, y) >> 6) + (y << 4);
72 y = fast_sqrt_tab[x >> 20];
73 y = (fast_div_u32_u8(x, y) >> 7) + (y << 5);
80 y = fast_sqrt_tab[x >> 22];
81 y = (fast_div_u32_u8(x, y) >> 8) + (y << 6);
85 y = fast_sqrt_tab[x >> 24];
86 y = (fast_div_u32_u8(x, y) >> 9) + (y << 7);
91 return (x < y * y) ? y - 1 : y;