Advertisement
tm512

fixed point stuff

Sep 24th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. inline fixed float_to_fixed (float a)
  2. {
  3.     return (fixed)(a * (1 << FRAC));
  4. }
  5.  
  6. inline fixed fixmul (fixed a, fixed b)
  7. {
  8.     return (fixed)((uint32) a * b >> FRAC);
  9. }
  10.  
  11. inline fixed fixdiv (fixed a, fixed b)
  12. {
  13.     return (fixed)((uint32) a / b << FRAC);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement