author | simon <simon> | 2002-04-30 14:52:52 (UTC) |
---|---|---|
committer | simon <simon> | 2002-04-30 14:52:52 (UTC) |
commit | 16e488f010e42436793619d918396f9453301d64 (patch) (unidiff) | |
tree | 1cb9030dc1ace82990c08afb5617d393a921ac2d | |
parent | c959b0c2170d2c12f93f5fa04ff02ca4c7c0ef4a (diff) | |
download | opie-16e488f010e42436793619d918396f9453301d64.zip opie-16e488f010e42436793619d918396f9453301d64.tar.gz opie-16e488f010e42436793619d918396f9453301d64.tar.bz2 |
- ostream is part of the std namespace
-rw-r--r-- | noncore/unsupported/qpdf/fixed.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/unsupported/qpdf/fixed.h b/noncore/unsupported/qpdf/fixed.h index c912954..e42aea0 100644 --- a/noncore/unsupported/qpdf/fixed.h +++ b/noncore/unsupported/qpdf/fixed.h | |||
@@ -135,55 +135,55 @@ template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> | |||
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 ); } | 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 | 136 | ||
137 | template <unsigned int SH> inline fixed<SH> operator + ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) + f. m_f, true ); } | 137 | template <unsigned int SH> inline fixed<SH> operator + ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) + f. m_f, true ); } |
138 | template <unsigned int SH> inline fixed<SH> operator - ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) - f. m_f, true ); } | 138 | template <unsigned int SH> inline fixed<SH> operator - ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) - f. m_f, true ); } |
139 | template <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 ); } | 139 | template <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 ); } |
140 | template <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 ); } | 140 | template <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 | 141 | ||
142 | template <unsigned int SH> inline bool operator < ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) < f. m_f; } | 142 | template <unsigned int SH> inline bool operator < ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) < f. m_f; } |
143 | template <unsigned int SH> inline bool operator > ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) > f. m_f; } | 143 | template <unsigned int SH> inline bool operator > ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) > f. m_f; } |
144 | template <unsigned int SH> inline bool operator <= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) <= f. m_f; } | 144 | template <unsigned int SH> inline bool operator <= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) <= f. m_f; } |
145 | template <unsigned int SH> inline bool operator >= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) >= f. m_f; } | 145 | template <unsigned int SH> inline bool operator >= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) >= f. m_f; } |
146 | template <unsigned int SH> inline bool operator == ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) == f. m_f; } | 146 | template <unsigned int SH> inline bool operator == ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) == f. m_f; } |
147 | template <unsigned int SH> inline bool operator != ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) != f. m_f; } | 147 | template <unsigned int SH> inline bool operator != ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) != f. m_f; } |
148 | 148 | ||
149 | template <unsigned int SH> inline bool operator < ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) < f. m_f; } | 149 | template <unsigned int SH> inline bool operator < ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) < f. m_f; } |
150 | template <unsigned int SH> inline bool operator > ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) > f. m_f; } | 150 | template <unsigned int SH> inline bool operator > ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) > f. m_f; } |
151 | template <unsigned int SH> inline bool operator <= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) <= f. m_f; } | 151 | template <unsigned int SH> inline bool operator <= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) <= f. m_f; } |
152 | template <unsigned int SH> inline bool operator >= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) >= f. m_f; } | 152 | template <unsigned int SH> inline bool operator >= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) >= f. m_f; } |
153 | template <unsigned int SH> inline bool operator == ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) == f. m_f; } | 153 | template <unsigned int SH> inline bool operator == ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) == f. m_f; } |
154 | template <unsigned int SH> inline bool operator != ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) != f. m_f; } | 154 | template <unsigned int SH> inline bool operator != ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) != f. m_f; } |
155 | 155 | ||
156 | template <unsigned int SH> inline long int lrint ( const fixed<SH> &f ) | 156 | template <unsigned int SH> inline long int lrint ( const fixed<SH> &f ) |
157 | { | 157 | { |
158 | return fixed<SH>::f2i (( f. m_f < 0 ) ? f. m_f - ( 1 << ( SH - 1 )) : f. m_f + ( 1 << ( SH - 1 ))); | 158 | return fixed<SH>::f2i (( f. m_f < 0 ) ? f. m_f - ( 1 << ( SH - 1 )) : f. m_f + ( 1 << ( SH - 1 ))); |
159 | } | 159 | } |
160 | 160 | ||
161 | template <unsigned int SH> inline fixed<SH> fabs ( const fixed<SH> &f ) | 161 | template <unsigned int SH> inline fixed<SH> fabs ( const fixed<SH> &f ) |
162 | { | 162 | { |
163 | return ( f. m_f < 0 ) ? fixed<SH> ( -f. m_f, true ) : f; | 163 | return ( f. m_f < 0 ) ? fixed<SH> ( -f. m_f, true ) : f; |
164 | } | 164 | } |
165 | 165 | ||
166 | // roughly from QPE / qmath.h | 166 | // roughly from QPE / qmath.h |
167 | template <unsigned int SH> inline fixed<SH> sqrt ( const fixed<SH> &f ) | 167 | template <unsigned int SH> inline fixed<SH> sqrt ( const fixed<SH> &f ) |
168 | { | 168 | { |
169 | if ( f. m_f <= 0 ) | 169 | if ( f. m_f <= 0 ) |
170 | return fixed<SH> ( 0, true ); | 170 | return fixed<SH> ( 0, true ); |
171 | 171 | ||
172 | fixed<SH>::fix_t a0 = 0; | 172 | fixed<SH>::fix_t a0 = 0; |
173 | fixed<SH>::fix_t a1 = f. m_f; // take value as first approximation | 173 | fixed<SH>::fix_t a1 = f. m_f; // take value as first approximation |
174 | 174 | ||
175 | do { | 175 | do { |
176 | a0 = a1; | 176 | a0 = a1; |
177 | a1 = ( a0 + fixed<SH>::div ( f. m_f, a0 )) >> 1; | 177 | a1 = ( a0 + fixed<SH>::div ( f. m_f, a0 )) >> 1; |
178 | } while ( abs ( fixed<SH>::div ( a1 - a0, a1 )) > 1 ); | 178 | } while ( abs ( fixed<SH>::div ( a1 - a0, a1 )) > 1 ); |
179 | 179 | ||
180 | return fixed<SH> ( a1, true ); | 180 | return fixed<SH> ( a1, true ); |
181 | } | 181 | } |
182 | 182 | ||
183 | template <unsigned int SH> inline ostream &operator << ( ostream &o, const fixed<SH> &f ) | 183 | template <unsigned int SH> inline std::ostream &operator << ( std::ostream &o, const fixed<SH> &f ) |
184 | { | 184 | { |
185 | o << double( f ); | 185 | o << double( f ); |
186 | return o; | 186 | return o; |
187 | } | 187 | } |
188 | 188 | ||
189 | #endif | 189 | #endif |