#ifndef FIXED_H #define FIXED_H /* * Copyright (c) Alex Holden 2000. * * This code is public domain; you can do whatever you want with it, though I * would prefer you to contribute any bug fixes back to me if possible. * This software comes with NO WARRANTY WHATSOEVER, not even the implied * warranties of merchantability and fitness for a particular purpose. */ typedef u32 fix; #ifndef FIX_PRECISION #define FIX_PRECISION 8 #endif #define inttofix(A) ((A) << FIX_PRECISION) #define fixtoint(A) ((A) >> FIX_PRECISION) #define fixmult(A, B) (((A) * (B)) >> FIX_PRECISION) #define fixdiv(A, B) (((A) << FIX_PRECISION) / (B)) #endif