]> icculus.org git repositories - taylor/freespace2.git/blob - src/math/fix.cpp
avoid sending LAN broadcast with PXO game query
[taylor/freespace2.git] / src / math / fix.cpp
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
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
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Math/Fix.cpp $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Code to deal with 16.16 fixed point numbers.
16  *
17  * $Log$
18  * Revision 1.3  2002/06/09 04:41:22  relnev
19  * added copyright header
20  *
21  * Revision 1.2  2002/05/07 03:16:46  theoddone33
22  * The Great Newline Fix
23  *
24  * Revision 1.1.1.1  2002/05/03 03:28:09  root
25  * Initial import.
26  *
27  * 
28  * 2     10/07/98 10:53a Dave
29  * Initial checkin.
30  * 
31  * 1     10/07/98 10:49a Dave
32  * 
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
35  * them.
36  *
37  * $NoKeywords: $
38  */
39
40
41 #include "pstypes.h"
42 #include "fix.h"
43
44 fix fixmul(fix a, fix b)
45 {
46         Sint64 tmp;
47         tmp = (Sint64)a * (Sint64)b;
48         return (fix)(tmp>>16);
49 }
50
51 fix fixdiv(fix a, fix b)
52 {
53         Sint64 ret = (Sint64)a << 16;
54         return (fix)(ret / b);
55 }
56
57 fix fixmuldiv(fix a, fix b,fix c)
58 {
59         Sint64 ret = (Sint64)a * (Sint64)b;
60         return (fix)(ret / c);
61 }
62