/usr/include/allegro/fix.h is in liballegro4-dev 2:4.4.2-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | /* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* C++ wrapper for fixed point math type.
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#ifndef ALLEGRO_FIX_H
#define ALLEGRO_FIX_H
#include "fixed.h"
#include "fmaths.h"
#ifdef __cplusplus
class fix /* C++ wrapper for the fixed point routines */
{
public:
fixed v;
fix() : v(0) {}
fix(const fix &x) : v(x.v) {}
explicit fix(const int x) : v(itofix(x)) {}
explicit fix(const long x) : v(itofix(x)) {}
explicit fix(const unsigned int x) : v(itofix(x)) {}
explicit fix(const unsigned long x) : v(itofix(x)) {}
explicit fix(const float x) : v(ftofix(x)) {}
explicit fix(const double x) : v(ftofix(x)) {}
operator int() const { return fixtoi(v); }
operator long() const { return fixtoi(v); }
operator unsigned int() const { return fixtoi(v); }
operator unsigned long() const { return fixtoi(v); }
operator float() const { return fixtof(v); }
operator double() const { return fixtof(v); }
fix& operator = (const fix &x) { v = x.v; return *this; }
fix& operator = (const int x) { v = itofix(x); return *this; }
fix& operator = (const long x) { v = itofix(x); return *this; }
fix& operator = (const unsigned int x) { v = itofix(x); return *this; }
fix& operator = (const unsigned long x) { v = itofix(x); return *this; }
fix& operator = (const float x) { v = ftofix(x); return *this; }
fix& operator = (const double x) { v = ftofix(x); return *this; }
fix& operator += (const fix x) { v += x.v; return *this; }
fix& operator += (const int x) { v += itofix(x); return *this; }
fix& operator += (const long x) { v += itofix(x); return *this; }
fix& operator += (const float x) { v += ftofix(x); return *this; }
fix& operator += (const double x) { v += ftofix(x); return *this; }
fix& operator -= (const fix x) { v -= x.v; return *this; }
fix& operator -= (const int x) { v -= itofix(x); return *this; }
fix& operator -= (const long x) { v -= itofix(x); return *this; }
fix& operator -= (const float x) { v -= ftofix(x); return *this; }
fix& operator -= (const double x) { v -= ftofix(x); return *this; }
fix& operator *= (const fix x) { v = fixmul(v, x.v); return *this; }
fix& operator *= (const int x) { v *= x; return *this; }
fix& operator *= (const long x) { v *= x; return *this; }
fix& operator *= (const float x) { v = ftofix(fixtof(v) * x); return *this; }
fix& operator *= (const double x) { v = ftofix(fixtof(v) * x); return *this; }
fix& operator /= (const fix x) { v = fixdiv(v, x.v); return *this; }
fix& operator /= (const int x) { v /= x; return *this; }
fix& operator /= (const long x) { v /= x; return *this; }
fix& operator /= (const float x) { v = ftofix(fixtof(v) / x); return *this; }
fix& operator /= (const double x) { v = ftofix(fixtof(v) / x); return *this; }
fix& operator <<= (const int x) { v <<= x; return *this; }
fix& operator >>= (const int x) { v >>= x; return *this; }
fix& operator ++ () { v += itofix(1); return *this; }
fix& operator -- () { v -= itofix(1); return *this; }
fix operator ++ (int) { fix t; t.v = v; v += itofix(1); return t; }
fix operator -- (int) { fix t; t.v = v; v -= itofix(1); return t; }
fix operator - () const { fix t; t.v = -v; return t; }
inline friend fix operator + (const fix x, const fix y);
inline friend fix operator + (const fix x, const int y);
inline friend fix operator + (const int x, const fix y);
inline friend fix operator + (const fix x, const long y);
inline friend fix operator + (const long x, const fix y);
inline friend fix operator + (const fix x, const float y);
inline friend fix operator + (const float x, const fix y);
inline friend fix operator + (const fix x, const double y);
inline friend fix operator + (const double x, const fix y);
inline friend fix operator - (const fix x, const fix y);
inline friend fix operator - (const fix x, const int y);
inline friend fix operator - (const int x, const fix y);
inline friend fix operator - (const fix x, const long y);
inline friend fix operator - (const long x, const fix y);
inline friend fix operator - (const fix x, const float y);
inline friend fix operator - (const float x, const fix y);
inline friend fix operator - (const fix x, const double y);
inline friend fix operator - (const double x, const fix y);
inline friend fix operator * (const fix x, const fix y);
inline friend fix operator * (const fix x, const int y);
inline friend fix operator * (const int x, const fix y);
inline friend fix operator * (const fix x, const long y);
inline friend fix operator * (const long x, const fix y);
inline friend fix operator * (const fix x, const float y);
inline friend fix operator * (const float x, const fix y);
inline friend fix operator * (const fix x, const double y);
inline friend fix operator * (const double x, const fix y);
inline friend fix operator / (const fix x, const fix y);
inline friend fix operator / (const fix x, const int y);
inline friend fix operator / (const int x, const fix y);
inline friend fix operator / (const fix x, const long y);
inline friend fix operator / (const long x, const fix y);
inline friend fix operator / (const fix x, const float y);
inline friend fix operator / (const float x, const fix y);
inline friend fix operator / (const fix x, const double y);
inline friend fix operator / (const double x, const fix y);
inline friend fix operator << (const fix x, const int y);
inline friend fix operator >> (const fix x, const int y);
inline friend int operator == (const fix x, const fix y);
inline friend int operator == (const fix x, const int y);
inline friend int operator == (const int x, const fix y);
inline friend int operator == (const fix x, const long y);
inline friend int operator == (const long x, const fix y);
inline friend int operator == (const fix x, const float y);
inline friend int operator == (const float x, const fix y);
inline friend int operator == (const fix x, const double y);
inline friend int operator == (const double x, const fix y);
inline friend int operator != (const fix x, const fix y);
inline friend int operator != (const fix x, const int y);
inline friend int operator != (const int x, const fix y);
inline friend int operator != (const fix x, const long y);
inline friend int operator != (const long x, const fix y);
inline friend int operator != (const fix x, const float y);
inline friend int operator != (const float x, const fix y);
inline friend int operator != (const fix x, const double y);
inline friend int operator != (const double x, const fix y);
inline friend int operator < (const fix x, const fix y);
inline friend int operator < (const fix x, const int y);
inline friend int operator < (const int x, const fix y);
inline friend int operator < (const fix x, const long y);
inline friend int operator < (const long x, const fix y);
inline friend int operator < (const fix x, const float y);
inline friend int operator < (const float x, const fix y);
inline friend int operator < (const fix x, const double y);
inline friend int operator < (const double x, const fix y);
inline friend int operator > (const fix x, const fix y);
inline friend int operator > (const fix x, const int y);
inline friend int operator > (const int x, const fix y);
inline friend int operator > (const fix x, const long y);
inline friend int operator > (const long x, const fix y);
inline friend int operator > (const fix x, const float y);
inline friend int operator > (const float x, const fix y);
inline friend int operator > (const fix x, const double y);
inline friend int operator > (const double x, const fix y);
inline friend int operator <= (const fix x, const fix y);
inline friend int operator <= (const fix x, const int y);
inline friend int operator <= (const int x, const fix y);
inline friend int operator <= (const fix x, const long y);
inline friend int operator <= (const long x, const fix y);
inline friend int operator <= (const fix x, const float y);
inline friend int operator <= (const float x, const fix y);
inline friend int operator <= (const fix x, const double y);
inline friend int operator <= (const double x, const fix y);
inline friend int operator >= (const fix x, const fix y);
inline friend int operator >= (const fix x, const int y);
inline friend int operator >= (const int x, const fix y);
inline friend int operator >= (const fix x, const long y);
inline friend int operator >= (const long x, const fix y);
inline friend int operator >= (const fix x, const float y);
inline friend int operator >= (const float x, const fix y);
inline friend int operator >= (const fix x, const double y);
inline friend int operator >= (const double x, const fix y);
inline friend fix sqrt(fix x);
inline friend fix cos(fix x);
inline friend fix sin(fix x);
inline friend fix tan(fix x);
inline friend fix acos(fix x);
inline friend fix asin(fix x);
inline friend fix atan(fix x);
inline friend fix atan2(fix x, fix y);
};
#endif /* ifdef __cplusplus */
#include "inline/fix.inl"
#endif /* ifndef ALLEGRO_FIX_H */
|