summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/fixed.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/fixed.h b/noncore/unsupported/qpdf/fixed.h
index ec0e696..44aaa5e 100644
--- a/noncore/unsupported/qpdf/fixed.h
+++ b/noncore/unsupported/qpdf/fixed.h
@@ -1,191 +1,192 @@
1#ifndef __FIXED_H__ 1#ifndef __FIXED_H__
2#define __FIXED_H__ 2#define __FIXED_H__
3 3
4#include <stdlib.h>
4#include <iostream> 5#include <iostream>
5 6
6#define _GCC_TEMPLATE_BUG_ 1 7#define _GCC_TEMPLATE_BUG_ 1
7 8
8template <unsigned int SH> class fixed { 9template <unsigned int SH> class fixed {
9public: 10public:
10 inline fixed ( int i = 0 ) : m_f ( i2f( i ) ) { } 11 inline fixed ( int i = 0 ) : m_f ( i2f( i ) ) { }
11 inline fixed ( double d ) : m_f ( d2f( d )) { } 12 inline fixed ( double d ) : m_f ( d2f( d )) { }
12 inline fixed ( const fixed &f ) : m_f ( f. m_f ) { } 13 inline fixed ( const fixed &f ) : m_f ( f. m_f ) { }
13 14
14 inline operator bool ( ) const { return m_f != 0; } 15 inline operator bool ( ) const { return m_f != 0; }
15 inline operator double ( ) const { return f2d( m_f ); } 16 inline operator double ( ) const { return f2d( m_f ); }
16 inline operator float ( ) const { return (float) f2d( m_f ); } 17 inline operator float ( ) const { return (float) f2d( m_f ); }
17 inline operator int ( ) const { return (int) f2i( m_f ); } 18 inline operator int ( ) const { return (int) f2i( m_f ); }
18 19
19 inline fixed &operator = ( const fixed &f ) { m_f = f. m_f; return *this; } 20 inline fixed &operator = ( const fixed &f ) { m_f = f. m_f; return *this; }
20 inline fixed &operator = ( double d ) { m_f = d2f( d ); return *this; } 21 inline fixed &operator = ( double d ) { m_f = d2f( d ); return *this; }
21 inline fixed &operator = ( float f ) { m_f = d2f( f ); return *this; } 22 inline fixed &operator = ( float f ) { m_f = d2f( f ); return *this; }
22 inline fixed &operator = ( int i ) { m_f = i2f( i ); return *this; } 23 inline fixed &operator = ( int i ) { m_f = i2f( i ); return *this; }
23 24
24 inline fixed &operator += ( const fixed &f ) { m_f += f. m_f; return *this; } 25 inline fixed &operator += ( const fixed &f ) { m_f += f. m_f; return *this; }
25 inline fixed &operator -= ( const fixed &f ) { m_f -= f. m_f; return *this; } 26 inline fixed &operator -= ( const fixed &f ) { m_f -= f. m_f; return *this; }
26 inline fixed &operator *= ( const fixed &f ) { m_f = mul ( m_f, f. m_f ); return *this; } 27 inline fixed &operator *= ( const fixed &f ) { m_f = mul ( m_f, f. m_f ); return *this; }
27 inline fixed &operator /= ( const fixed &f ) { m_f = div ( m_f, f. m_f ); return *this; } 28 inline fixed &operator /= ( const fixed &f ) { m_f = div ( m_f, f. m_f ); return *this; }
28 29
29 inline fixed &operator += ( int i ) { m_f += i2f( i ); return *this; } 30 inline fixed &operator += ( int i ) { m_f += i2f( i ); return *this; }
30 inline fixed &operator -= ( int i ) { m_f -= i2f( i ); return *this; } 31 inline fixed &operator -= ( int i ) { m_f -= i2f( i ); return *this; }
31 inline fixed &operator *= ( int i ) { m_f *= i; return *this; } 32 inline fixed &operator *= ( int i ) { m_f *= i; return *this; }
32 inline fixed &operator /= ( int i ) { m_f /= i; return *this; } 33 inline fixed &operator /= ( int i ) { m_f /= i; return *this; }
33 34
34 inline fixed &operator += ( double d ) { m_f += d2f( d ); return *this; } 35 inline fixed &operator += ( double d ) { m_f += d2f( d ); return *this; }
35 inline fixed &operator -= ( double d ) { m_f -= d2f( d ); return *this; } 36 inline fixed &operator -= ( double d ) { m_f -= d2f( d ); return *this; }
36 inline fixed &operator *= ( double d ) { m_f = mul ( m_f, d2f( d )); return *this; } 37 inline fixed &operator *= ( double d ) { m_f = mul ( m_f, d2f( d )); return *this; }
37 inline fixed &operator /= ( double d ) { m_f = div ( m_f, d2f( d )); return *this; } 38 inline fixed &operator /= ( double d ) { m_f = div ( m_f, d2f( d )); return *this; }
38 39
39 inline fixed operator - ( ) const { return fixed ( -m_f, true ); } 40 inline fixed operator - ( ) const { return fixed ( -m_f, true ); }
40 41
41 inline fixed operator + ( const fixed &f ) const { return fixed ( m_f + f. m_f, true ); } 42 inline fixed operator + ( const fixed &f ) const { return fixed ( m_f + f. m_f, true ); }
42 inline fixed operator - ( const fixed &f ) const { return fixed ( m_f - f. m_f, true ); } 43 inline fixed operator - ( const fixed &f ) const { return fixed ( m_f - f. m_f, true ); }
43 inline fixed operator * ( const fixed &f ) const { return fixed ( mul ( m_f, f. m_f ), true ); } 44 inline fixed operator * ( const fixed &f ) const { return fixed ( mul ( m_f, f. m_f ), true ); }
44 inline fixed operator / ( const fixed &f ) const { return fixed ( div ( m_f, f. m_f ), true ); } 45 inline fixed operator / ( const fixed &f ) const { return fixed ( div ( m_f, f. m_f ), true ); }
45 46
46 inline fixed operator + ( double d ) const { return fixed ( m_f + d2f( d ), true ); } 47 inline fixed operator + ( double d ) const { return fixed ( m_f + d2f( d ), true ); }
47 inline fixed operator - ( double d ) const { return fixed ( m_f - d2f( d ), true ); } 48 inline fixed operator - ( double d ) const { return fixed ( m_f - d2f( d ), true ); }
48 inline fixed operator * ( double d ) const { return fixed ( mul ( m_f, d2f( d )), true ); } 49 inline fixed operator * ( double d ) const { return fixed ( mul ( m_f, d2f( d )), true ); }
49 inline fixed operator / ( double d ) const { return fixed ( div ( m_f, d2f( d )), true ); } 50 inline fixed operator / ( double d ) const { return fixed ( div ( m_f, d2f( d )), true ); }
50 51
51 inline fixed operator + ( int i ) const { return fixed ( m_f + i2f( i ), true ); } 52 inline fixed operator + ( int i ) const { return fixed ( m_f + i2f( i ), true ); }
52 inline fixed operator - ( int i ) const { return fixed ( m_f - i2f( i ), true ); } 53 inline fixed operator - ( int i ) const { return fixed ( m_f - i2f( i ), true ); }
53 inline fixed operator * ( int i ) const { return fixed ( m_f * i, true ); } 54 inline fixed operator * ( int i ) const { return fixed ( m_f * i, true ); }
54 inline fixed operator / ( int i ) const { return fixed ( m_f / i, true ); } 55 inline fixed operator / ( int i ) const { return fixed ( m_f / i, true ); }
55 56
56 inline bool operator < ( const fixed &f ) const { return m_f < f. m_f; } 57 inline bool operator < ( const fixed &f ) const { return m_f < f. m_f; }
57 inline bool operator > ( const fixed &f ) const { return m_f > f. m_f; } 58 inline bool operator > ( const fixed &f ) const { return m_f > f. m_f; }
58 inline bool operator <= ( const fixed &f ) const { return m_f <= f. m_f; } 59 inline bool operator <= ( const fixed &f ) const { return m_f <= f. m_f; }
59 inline bool operator >= ( const fixed &f ) const { return m_f >= f. m_f; } 60 inline bool operator >= ( const fixed &f ) const { return m_f >= f. m_f; }
60 inline bool operator == ( const fixed &f ) const { return m_f == f. m_f; } 61 inline bool operator == ( const fixed &f ) const { return m_f == f. m_f; }
61 inline bool operator != ( const fixed &f ) const { return m_f != f. m_f; } 62 inline bool operator != ( const fixed &f ) const { return m_f != f. m_f; }
62 63
63 inline bool operator < ( double d ) const { return m_f < d2f( d ); } 64 inline bool operator < ( double d ) const { return m_f < d2f( d ); }
64 inline bool operator > ( double d ) const { return m_f > d2f( d ); } 65 inline bool operator > ( double d ) const { return m_f > d2f( d ); }
65 inline bool operator <= ( double d ) const { return m_f <= d2f( d ); } 66 inline bool operator <= ( double d ) const { return m_f <= d2f( d ); }
66 inline bool operator >= ( double d ) const { return m_f >= d2f( d ); } 67 inline bool operator >= ( double d ) const { return m_f >= d2f( d ); }
67 inline bool operator == ( double d ) const { return m_f == d2f( d ); } 68 inline bool operator == ( double d ) const { return m_f == d2f( d ); }
68 inline bool operator != ( double d ) const { return m_f != d2f( d ); } 69 inline bool operator != ( double d ) const { return m_f != d2f( d ); }
69 70
70 inline bool operator < ( int i ) const { return m_f < i2f( i ); } 71 inline bool operator < ( int i ) const { return m_f < i2f( i ); }
71 inline bool operator > ( int i ) const { return m_f > i2f( i ); } 72 inline bool operator > ( int i ) const { return m_f > i2f( i ); }
72 inline bool operator <= ( int i ) const { return m_f <= i2f( i ); } 73 inline bool operator <= ( int i ) const { return m_f <= i2f( i ); }
73 inline bool operator >= ( int i ) const { return m_f >= i2f( i ); } 74 inline bool operator >= ( int i ) const { return m_f >= i2f( i ); }
74 inline bool operator == ( int i ) const { return m_f == i2f( i ); } 75 inline bool operator == ( int i ) const { return m_f == i2f( i ); }
75 inline bool operator != ( int i ) const { return m_f != i2f( i ); } 76 inline bool operator != ( int i ) const { return m_f != i2f( i ); }
76 77
77#if _GCC_TEMPLATE_BUG_ 78#if _GCC_TEMPLATE_BUG_
78public: 79public:
79#else 80#else
80private: 81private:
81#endif 82#endif
82 typedef int fix_t; 83 typedef int fix_t;
83 84
84 inline static double f2d ( fix_t f ) { return ((double) f ) / ((double) ( 1 << SH )); } 85 inline static double f2d ( fix_t f ) { return ((double) f ) / ((double) ( 1 << SH )); }
85 inline static fix_t d2f ( double d ) { return (fix_t) ( d * ((double) ( 1 << SH ))); } 86 inline static fix_t d2f ( double d ) { return (fix_t) ( d * ((double) ( 1 << SH ))); }
86 87
87 inline static int f2i ( fix_t f ) { return (int) ( f >> SH ); } 88 inline static int f2i ( fix_t f ) { return (int) ( f >> SH ); }
88 inline static fix_t i2f ( int i ) { return (fix_t) ( i << SH ); } 89 inline static fix_t i2f ( int i ) { return (fix_t) ( i << SH ); }
89 90
90 inline static fix_t mul ( fix_t m1, fix_t m2 ) { return (fix_t) ((((long long int) m1 ) * m2 ) >> SH ); } 91 inline static fix_t mul ( fix_t m1, fix_t m2 ) { return (fix_t) ((((long long int) m1 ) * m2 ) >> SH ); }
91 inline static fix_t div ( fix_t d1, fix_t d2 ){ return (fix_t) ((((long long int) d1 ) << SH ) / d2 ); } 92 inline static fix_t div ( fix_t d1, fix_t d2 ){ return (fix_t) ((((long long int) d1 ) << SH ) / d2 ); }
92 93
93 fixed ( fix_t f, bool /*dummy*/ ) : m_f ( f ) { } 94 fixed ( fix_t f, bool /*dummy*/ ) : m_f ( f ) { }
94 95
95 //data 96 //data
96 fix_t m_f; 97 fix_t m_f;
97 98
98 // friends: 99 // friends:
99#if !_GCC_TEMPLATE_BUG_ 100#if !_GCC_TEMPLATE_BUG_
100 friend fixed operator + <> ( int i, const fixed &f ); 101 friend fixed operator + <> ( int i, const fixed &f );
101 friend fixed operator - <> ( int i, const fixed &f ); 102 friend fixed operator - <> ( int i, const fixed &f );
102 friend fixed operator * <> ( int i, const fixed &f ); 103 friend fixed operator * <> ( int i, const fixed &f );
103 friend fixed operator / <> ( int i, const fixed &f ); 104 friend fixed operator / <> ( int i, const fixed &f );
104 105
105 friend fixed operator + <> ( double d, const fixed &f ); 106 friend fixed operator + <> ( double d, const fixed &f );
106 friend fixed operator - <> ( double d, const fixed &f ); 107 friend fixed operator - <> ( double d, const fixed &f );
107 friend fixed operator * <> ( double d, const fixed &f ); 108 friend fixed operator * <> ( double d, const fixed &f );
108 friend fixed &operator / <> ( double d, const fixed<SH> &f ); 109 friend fixed &operator / <> ( double d, const fixed<SH> &f );
109 110
110 friend bool operator < <> ( double d, const fixed &f ); 111 friend bool operator < <> ( double d, const fixed &f );
111 friend bool operator > <> ( double d, const fixed &f ); 112 friend bool operator > <> ( double d, const fixed &f );
112 friend bool operator <= <> ( double d, const fixed &f ); 113 friend bool operator <= <> ( double d, const fixed &f );
113 friend bool operator >= <> ( double d, const fixed &f ); 114 friend bool operator >= <> ( double d, const fixed &f );
114 friend bool operator == <> ( double d, const fixed &f ); 115 friend bool operator == <> ( double d, const fixed &f );
115 friend bool operator != <> ( double d, const fixed &f ); 116 friend bool operator != <> ( double d, const fixed &f );
116 117
117 friend bool operator < <> ( int i, const fixed &f ); 118 friend bool operator < <> ( int i, const fixed &f );
118 friend bool operator > <> ( int i, const fixed &f ); 119 friend bool operator > <> ( int i, const fixed &f );
119 friend bool operator <= <> ( int i, const fixed &f ); 120 friend bool operator <= <> ( int i, const fixed &f );
120 friend bool operator >= <> ( int i, const fixed &f ); 121 friend bool operator >= <> ( int i, const fixed &f );
121 friend bool operator == <> ( int i, const fixed &f ); 122 friend bool operator == <> ( int i, const fixed &f );
122 friend bool operator != <> ( int i, const fixed &f ); 123 friend bool operator != <> ( int i, const fixed &f );
123 124
124 friend long int lrint ( const fixed &f ); 125 friend long int lrint ( const fixed &f );
125 friend fixed sqrt ( const fixed &f ); 126 friend fixed sqrt ( const fixed &f );
126 friend fixed fabs ( const fixed &f ); 127 friend fixed fabs ( const fixed &f );
127#endif 128#endif
128}; 129};
129 130
130 131
131template <unsigned int SH> inline fixed<SH> operator + ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) + f. m_f, true ); } 132template <unsigned int SH> inline fixed<SH> operator + ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) + f. m_f, true ); }
132template <unsigned int SH> inline fixed<SH> operator - ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) - f. m_f, true ); } 133template <unsigned int SH> inline fixed<SH> operator - ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) - f. m_f, true ); }
133template <unsigned int SH> inline fixed<SH> operator * ( int i, const fixed<SH> &f ) { return fixed<SH> ( i * f. m_f, true ); } 134template <unsigned int SH> inline fixed<SH> operator * ( int i, const fixed<SH> &f ) { return fixed<SH> ( i * f. m_f, true ); }
134template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::div ( fixed<SH>::i2f( i ), f. m_f ), true ); } 135template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::div ( fixed<SH>::i2f( i ), f. m_f ), true ); }
135//template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f ( i / fixed<SH>::f2i ( f. m_f )), true ); } 136//template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f ( i / fixed<SH>::f2i ( f. m_f )), true ); }
136 137
137template <unsigned int SH> inline fixed<SH> operator + ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) + f. m_f, true ); } 138template <unsigned int SH> inline fixed<SH> operator + ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) + f. m_f, true ); }
138template <unsigned int SH> inline fixed<SH> operator - ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) - f. m_f, true ); } 139template <unsigned int SH> inline fixed<SH> operator - ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) - f. m_f, true ); }
139template <unsigned int SH> inline fixed<SH> operator * ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::mul ( fixed<SH>::d2f( d ), f. m_f ), true ); } 140template <unsigned int SH> inline fixed<SH> operator * ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::mul ( fixed<SH>::d2f( d ), f. m_f ), true ); }
140template <unsigned int SH> inline fixed<SH> operator / ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::mul ( fixed<SH>::d2f( d ), f. m_f ), true ); } 141template <unsigned int SH> inline fixed<SH> operator / ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::mul ( fixed<SH>::d2f( d ), f. m_f ), true ); }
141 142
142template <unsigned int SH> inline bool operator < ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) < f. m_f; } 143template <unsigned int SH> inline bool operator < ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) < f. m_f; }
143template <unsigned int SH> inline bool operator > ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) > f. m_f; } 144template <unsigned int SH> inline bool operator > ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) > f. m_f; }
144template <unsigned int SH> inline bool operator <= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) <= f. m_f; } 145template <unsigned int SH> inline bool operator <= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) <= f. m_f; }
145template <unsigned int SH> inline bool operator >= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) >= f. m_f; } 146template <unsigned int SH> inline bool operator >= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) >= f. m_f; }
146template <unsigned int SH> inline bool operator == ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) == f. m_f; } 147template <unsigned int SH> inline bool operator == ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) == f. m_f; }
147template <unsigned int SH> inline bool operator != ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) != f. m_f; } 148template <unsigned int SH> inline bool operator != ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) != f. m_f; }
148 149
149template <unsigned int SH> inline bool operator < ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) < f. m_f; } 150template <unsigned int SH> inline bool operator < ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) < f. m_f; }
150template <unsigned int SH> inline bool operator > ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) > f. m_f; } 151template <unsigned int SH> inline bool operator > ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) > f. m_f; }
151template <unsigned int SH> inline bool operator <= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) <= f. m_f; } 152template <unsigned int SH> inline bool operator <= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) <= f. m_f; }
152template <unsigned int SH> inline bool operator >= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) >= f. m_f; } 153template <unsigned int SH> inline bool operator >= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) >= f. m_f; }
153template <unsigned int SH> inline bool operator == ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) == f. m_f; } 154template <unsigned int SH> inline bool operator == ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) == f. m_f; }
154template <unsigned int SH> inline bool operator != ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) != f. m_f; } 155template <unsigned int SH> inline bool operator != ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) != f. m_f; }
155 156
156template <unsigned int SH> inline long int lrint ( const fixed<SH> &f ) 157template <unsigned int SH> inline long int lrint ( const fixed<SH> &f )
157{ 158{
158 return fixed<SH>::f2i (( f. m_f < 0 ) ? f. m_f - ( 1 << ( SH - 1 )) : f. m_f + ( 1 << ( SH - 1 ))); 159 return fixed<SH>::f2i (( f. m_f < 0 ) ? f. m_f - ( 1 << ( SH - 1 )) : f. m_f + ( 1 << ( SH - 1 )));
159} 160}
160 161
161template <unsigned int SH> inline fixed<SH> fabs ( const fixed<SH> &f ) 162template <unsigned int SH> inline fixed<SH> fabs ( const fixed<SH> &f )
162{ 163{
163 return ( f. m_f < 0 ) ? fixed<SH> ( -f. m_f, true ) : f; 164 return ( f. m_f < 0 ) ? fixed<SH> ( -f. m_f, true ) : f;
164} 165}
165 166
166// roughly from QPE / qmath.h 167// roughly from QPE / qmath.h
167template <unsigned int SH> inline fixed<SH> sqrt ( const fixed<SH> &f ) 168template <unsigned int SH> inline fixed<SH> sqrt ( const fixed<SH> &f )
168{ 169{
169 if ( f. m_f <= 0 ) 170 if ( f. m_f <= 0 )
170 return fixed<SH> ( 0, true ); 171 return fixed<SH> ( 0, true );
171 172
172 typename fixed<SH>::fix_t a0 = 0; 173 typename fixed<SH>::fix_t a0 = 0;
173 typename fixed<SH>::fix_t a1 = f. m_f; // take value as first approximation 174 typename fixed<SH>::fix_t a1 = f. m_f; // take value as first approximation
174 175
175 do { 176 do {
176 a0 = a1; 177 a0 = a1;
177 a1 = ( a0 + fixed<SH>::div ( f. m_f, a0 )) >> 1; 178 a1 = ( a0 + fixed<SH>::div ( f. m_f, a0 )) >> 1;
178 } while ( abs ( fixed<SH>::div ( a1 - a0, a1 )) > 1 ); 179 } while ( abs ( fixed<SH>::div ( a1 - a0, a1 )) > 1 );
179 180
180 return fixed<SH> ( a1, true ); 181 return fixed<SH> ( a1, true );
181} 182}
182 183
183#if 0 // no std::ostream needed in OPIE 184#if 0 // no std::ostream needed in OPIE
184template <unsigned int SH> inline std::ostream &operator << ( std::ostream &o, const fixed<SH> &f ) 185template <unsigned int SH> inline std::ostream &operator << ( std::ostream &o, const fixed<SH> &f )
185{ 186{
186 o << double( f ); 187 o << double( f );
187 return o; 188 return o;
188} 189}
189#endif 190#endif
190 191
191#endif 192#endif