diff options
Diffstat (limited to 'apps/codecs/libatrac/fixp_math.h')
-rw-r--r-- | apps/codecs/libatrac/fixp_math.h | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/apps/codecs/libatrac/fixp_math.h b/apps/codecs/libatrac/fixp_math.h index 5174cc7cc6..29d47a9e53 100644 --- a/apps/codecs/libatrac/fixp_math.h +++ b/apps/codecs/libatrac/fixp_math.h | |||
@@ -91,46 +91,3 @@ | |||
91 | return (int32_t)temp; | 91 | return (int32_t)temp; |
92 | } | 92 | } |
93 | #endif | 93 | #endif |
94 | |||
95 | static inline int32_t fixdiv16(int32_t x, int32_t y) | ||
96 | { | ||
97 | int64_t temp; | ||
98 | temp = x << 16; | ||
99 | temp /= y; | ||
100 | |||
101 | return (int32_t)temp; | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * Fast integer square root adapted from algorithm, | ||
106 | * Martin Guy @ UKC, June 1985. | ||
107 | * Originally from a book on programming abaci by Mr C. Woo. | ||
108 | * This is taken from : | ||
109 | * http://wiki.forum.nokia.com/index.php/How_to_use_fixed_point_maths#How_to_get_square_root_for_integers | ||
110 | * with a added shift up of the result by 8 bits to return result in 16.16 fixed-point representation. | ||
111 | */ | ||
112 | static inline int32_t fastSqrt(int32_t n) | ||
113 | { | ||
114 | /* | ||
115 | * Logically, these are unsigned. | ||
116 | * We need the sign bit to test | ||
117 | * whether (op - res - one) underflowed. | ||
118 | */ | ||
119 | int32_t op, res, one; | ||
120 | op = n; | ||
121 | res = 0; | ||
122 | /* "one" starts at the highest power of four <= than the argument. */ | ||
123 | one = 1 << 30; /* second-to-top bit set */ | ||
124 | while (one > op) one >>= 2; | ||
125 | while (one != 0) | ||
126 | { | ||
127 | if (op >= res + one) | ||
128 | { | ||
129 | op = op - (res + one); | ||
130 | res = res + (one<<1); | ||
131 | } | ||
132 | res >>= 1; | ||
133 | one >>= 2; | ||
134 | } | ||
135 | return(res << 8); | ||
136 | } | ||