… | |
… | |
214 | isqrt (int n) |
214 | isqrt (int n) |
215 | { |
215 | { |
216 | return (int)sqrtf ((float)n); |
216 | return (int)sqrtf ((float)n); |
217 | } |
217 | } |
218 | |
218 | |
|
|
219 | // this is kind of like the ^^ operator, if it would exist, without sequence point. |
|
|
220 | // more handy than it looks like, due to the implicit !! done on its arguments |
|
|
221 | inline bool |
|
|
222 | logical_xor (bool a, bool b) |
|
|
223 | { |
|
|
224 | return a != b; |
|
|
225 | } |
|
|
226 | |
|
|
227 | inline bool |
|
|
228 | logical_implies (bool a, bool b) |
|
|
229 | { |
|
|
230 | return a <= b; |
|
|
231 | } |
|
|
232 | |
219 | // this is only twice as fast as naive sqrtf (dx*dy+dy*dy) |
233 | // this is only twice as fast as naive sqrtf (dx*dy+dy*dy) |
220 | #if 0 |
234 | #if 0 |
221 | // and has a max. error of 6 in the range -100..+100. |
235 | // and has a max. error of 6 in the range -100..+100. |
222 | #else |
236 | #else |
223 | // and has a max. error of 9 in the range -100..+100. |
237 | // and has a max. error of 9 in the range -100..+100. |