author | sandman <sandman> | 2002-05-23 20:09:42 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-05-23 20:09:42 (UTC) |
commit | 582f7e6b7da49b90d2cfccd638bccd4ca279da37 (patch) (unidiff) | |
tree | 703fb12864b2efa611a280b15890a0b94530dc35 | |
parent | 343f008ab9a6905ff6f9c953279e84cc581ea8b6 (diff) | |
download | opie-582f7e6b7da49b90d2cfccd638bccd4ca279da37.zip opie-582f7e6b7da49b90d2cfccd638bccd4ca279da37.tar.gz opie-582f7e6b7da49b90d2cfccd638bccd4ca279da37.tar.bz2 |
Removed unused operator<<(ostream&)
-rw-r--r-- | noncore/unsupported/qpdf/fixed.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/fixed.h b/noncore/unsupported/qpdf/fixed.h index e42aea0..d073421 100644 --- a/noncore/unsupported/qpdf/fixed.h +++ b/noncore/unsupported/qpdf/fixed.h | |||
@@ -55,135 +55,137 @@ public: | |||
55 | 55 | ||
56 | inline bool operator < ( const fixed &f ) const { return m_f < f. m_f; } | 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 | 62 | ||
63 | inline bool operator < ( double d ) const { return m_f < d2f( d ); } | 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 | 69 | ||
70 | inline bool operator < ( int i ) const { return m_f < i2f( i ); } | 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 | 76 | ||
77 | #if _GCC_TEMPLATE_BUG_ | 77 | #if _GCC_TEMPLATE_BUG_ |
78 | public: | 78 | public: |
79 | #else | 79 | #else |
80 | private: | 80 | private: |
81 | #endif | 81 | #endif |
82 | typedef int fix_t; | 82 | typedef int fix_t; |
83 | 83 | ||
84 | inline static double f2d ( fix_t f ) { return ((double) f ) / ((double) ( 1 << SH )); } | 84 | 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 ))); } | 85 | inline static fix_t d2f ( double d ) { return (fix_t) ( d * ((double) ( 1 << SH ))); } |
86 | 86 | ||
87 | inline static int f2i ( fix_t f ) { return (int) ( f >> SH ); } | 87 | inline static int f2i ( fix_t f ) { return (int) ( f >> SH ); } |
88 | inline static fix_t i2f ( int i ) { return (fix_t) ( i << SH ); } | 88 | inline static fix_t i2f ( int i ) { return (fix_t) ( i << SH ); } |
89 | 89 | ||
90 | inline static fix_t mul ( fix_t m1, fix_t m2 ) { return (fix_t) ((((long long int) m1 ) * m2 ) >> SH ); } | 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 div ( fix_t d1, fix_t d2 ){ return (fix_t) ((((long long int) d1 ) << SH ) / d2 ); } | 91 | inline static fix_t div ( fix_t d1, fix_t d2 ){ return (fix_t) ((((long long int) d1 ) << SH ) / d2 ); } |
92 | 92 | ||
93 | fixed ( fix_t f, bool /*dummy*/ ) : m_f ( f ) { } | 93 | fixed ( fix_t f, bool /*dummy*/ ) : m_f ( f ) { } |
94 | 94 | ||
95 | //data | 95 | //data |
96 | fix_t m_f; | 96 | fix_t m_f; |
97 | 97 | ||
98 | // friends: | 98 | // friends: |
99 | #if !_GCC_TEMPLATE_BUG_ | 99 | #if !_GCC_TEMPLATE_BUG_ |
100 | friend fixed operator + <> ( int i, const fixed &f ); | 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 | 104 | ||
105 | friend fixed operator + <> ( double d, const fixed &f ); | 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<SH> &f ); | 108 | friend fixed &operator / <> ( double d, const fixed<SH> &f ); |
109 | 109 | ||
110 | friend bool operator < <> ( double d, const fixed &f ); | 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 | 116 | ||
117 | friend bool operator < <> ( int i, const fixed &f ); | 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 | 123 | ||
124 | friend long int lrint ( const fixed &f ); | 124 | friend long int lrint ( const fixed &f ); |
125 | friend fixed sqrt ( const fixed &f ); | 125 | friend fixed sqrt ( const fixed &f ); |
126 | friend fixed fabs ( const fixed &f ); | 126 | friend fixed fabs ( const fixed &f ); |
127 | #endif | 127 | #endif |
128 | }; | 128 | }; |
129 | 129 | ||
130 | 130 | ||
131 | template <unsigned int SH> inline fixed<SH> operator + ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) + f. m_f, true ); } | 131 | template <unsigned int SH> inline fixed<SH> operator + ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) + f. m_f, true ); } |
132 | template <unsigned int SH> inline fixed<SH> operator - ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) - f. m_f, true ); } | 132 | template <unsigned int SH> inline fixed<SH> operator - ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) - f. m_f, true ); } |
133 | template <unsigned int SH> inline fixed<SH> operator * ( int i, const fixed<SH> &f ) { return fixed<SH> ( i * f. m_f, true ); } | 133 | template <unsigned int SH> inline fixed<SH> operator * ( int i, const fixed<SH> &f ) { return fixed<SH> ( i * f. m_f, true ); } |
134 | template <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 ); } | 134 | template <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 ); } | 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 | #if 0 // no std::ostream needed in OPIE | ||
183 | template <unsigned int SH> inline std::ostream &operator << ( std::ostream &o, const fixed<SH> &f ) | 184 | template <unsigned int SH> inline std::ostream &operator << ( std::ostream &o, const fixed<SH> &f ) |
184 | { | 185 | { |
185 | o << double( f ); | 186 | o << double( f ); |
186 | return o; | 187 | return o; |
187 | } | 188 | } |
189 | #endif | ||
188 | 190 | ||
189 | #endif | 191 | #endif |