2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Math/Fix.cpp $
15 * Code to deal with 16.16 fixed point numbers.
18 * Revision 1.3 2002/06/09 04:41:22 relnev
19 * added copyright header
21 * Revision 1.2 2002/05/07 03:16:46 theoddone33
22 * The Great Newline Fix
24 * Revision 1.1.1.1 2002/05/03 03:28:09 root
28 * 2 10/07/98 10:53a Dave
31 * 1 10/07/98 10:49a Dave
33 * 2 2/17/97 5:18p John
34 * Added a bunch of RCS headers to a bunch of old files that don't have
48 fix fixmul(fix a, fix b)
51 tmp = (Sint64)a * (Sint64)b;
52 return (fix)(tmp>>16);
55 fix fixdiv(fix a, fix b)
57 Sint64 ret = (Sint64)a << 16;
58 return (fix)(ret / b);
61 fix fixmuldiv(fix a, fix b,fix c)
63 Sint64 ret = (Sint64)a * (Sint64)b;
64 return (fix)(ret / c);