| 170 | } |
| 171 | |
| 172 | static inline S32 clampRangeClamp(F32 val) |
| 173 | { |
| 174 | if(val < -1) |
| 175 | return 0; |
| 176 | if(val > 1) |
| 177 | return 32; |
| 178 | |
| 179 | // 0.5 / 16 = 0.03125 ... this forces a round up to |
| 180 | // make the precision near zero equal in the negative |
| 181 | // and positive directions. See... |
| 182 | // |
| 183 | // http://www.garagegames.com/community/forums/viewthread/49714 |
| 184 | |
| 185 | return (S32)((val + 1.03125) * 16); |
| 186 | } |
| 187 | |
| 188 | |
| 189 | #define FANG2IANG(x) ((U32)((S16)((F32(0x10000) / M_2PI) * x)) & 0xFFFF) |