author | leseb <leseb> | 2002-07-04 12:22:09 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-07-04 12:22:09 (UTC) |
commit | 61b99edb481444aea41fa47853a5d60c78bfaa3c (patch) (side-by-side diff) | |
tree | ccfc78298de44fa6040313b054c54c5ab8c6ec83 | |
parent | 3035c46ce448317f786d974094f78ce43e594a57 (diff) | |
download | opie-61b99edb481444aea41fa47853a5d60c78bfaa3c.zip opie-61b99edb481444aea41fa47853a5d60c78bfaa3c.tar.gz opie-61b99edb481444aea41fa47853a5d60c78bfaa3c.tar.bz2 |
Fix for compiling on x86 (Red Hat)
-rw-r--r-- | noncore/unsupported/qpdf/fixed.h | 1 |
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,99 +1,100 @@ #ifndef __FIXED_H__ #define __FIXED_H__ +#include <stdlib.h> #include <iostream> #define _GCC_TEMPLATE_BUG_ 1 template <unsigned int SH> class fixed { public: inline fixed ( int i = 0 ) : m_f ( i2f( i ) ) { } inline fixed ( double d ) : m_f ( d2f( d )) { } inline fixed ( const fixed &f ) : m_f ( f. m_f ) { } inline operator bool ( ) const { return m_f != 0; } inline operator double ( ) const { return f2d( m_f ); } inline operator float ( ) const { return (float) f2d( m_f ); } inline operator int ( ) const { return (int) f2i( m_f ); } inline fixed &operator = ( const fixed &f ) { m_f = f. m_f; return *this; } inline fixed &operator = ( double d ) { m_f = d2f( d ); return *this; } inline fixed &operator = ( float f ) { m_f = d2f( f ); return *this; } inline fixed &operator = ( int i ) { m_f = i2f( i ); return *this; } inline fixed &operator += ( const fixed &f ) { m_f += f. m_f; return *this; } inline fixed &operator -= ( const fixed &f ) { m_f -= f. m_f; return *this; } inline fixed &operator *= ( const fixed &f ) { m_f = mul ( m_f, f. m_f ); return *this; } inline fixed &operator /= ( const fixed &f ) { m_f = div ( m_f, f. m_f ); return *this; } inline fixed &operator += ( int i ) { m_f += i2f( i ); return *this; } inline fixed &operator -= ( int i ) { m_f -= i2f( i ); return *this; } inline fixed &operator *= ( int i ) { m_f *= i; return *this; } inline fixed &operator /= ( int i ) { m_f /= i; return *this; } inline fixed &operator += ( double d ) { m_f += d2f( d ); return *this; } inline fixed &operator -= ( double d ) { m_f -= d2f( d ); return *this; } inline fixed &operator *= ( double d ) { m_f = mul ( m_f, d2f( d )); return *this; } inline fixed &operator /= ( double d ) { m_f = div ( m_f, d2f( d )); return *this; } inline fixed operator - ( ) const { return fixed ( -m_f, true ); } inline fixed operator + ( const fixed &f ) const { return fixed ( m_f + f. m_f, true ); } inline fixed operator - ( const fixed &f ) const { return fixed ( m_f - f. m_f, true ); } inline fixed operator * ( const fixed &f ) const { return fixed ( mul ( m_f, f. m_f ), true ); } inline fixed operator / ( const fixed &f ) const { return fixed ( div ( m_f, f. m_f ), true ); } inline fixed operator + ( double d ) const { return fixed ( m_f + d2f( d ), true ); } inline fixed operator - ( double d ) const { return fixed ( m_f - d2f( d ), true ); } inline fixed operator * ( double d ) const { return fixed ( mul ( m_f, d2f( d )), true ); } inline fixed operator / ( double d ) const { return fixed ( div ( m_f, d2f( d )), true ); } inline fixed operator + ( int i ) const { return fixed ( m_f + i2f( i ), true ); } inline fixed operator - ( int i ) const { return fixed ( m_f - i2f( i ), true ); } inline fixed operator * ( int i ) const { return fixed ( m_f * i, true ); } inline fixed operator / ( int i ) const { return fixed ( m_f / i, true ); } inline bool operator < ( const fixed &f ) const { return m_f < f. m_f; } inline bool operator > ( const fixed &f ) const { return m_f > f. m_f; } inline bool operator <= ( const fixed &f ) const { return m_f <= f. m_f; } inline bool operator >= ( const fixed &f ) const { return m_f >= f. m_f; } inline bool operator == ( const fixed &f ) const { return m_f == f. m_f; } inline bool operator != ( const fixed &f ) const { return m_f != f. m_f; } inline bool operator < ( double d ) const { return m_f < d2f( d ); } inline bool operator > ( double d ) const { return m_f > d2f( d ); } inline bool operator <= ( double d ) const { return m_f <= d2f( d ); } inline bool operator >= ( double d ) const { return m_f >= d2f( d ); } inline bool operator == ( double d ) const { return m_f == d2f( d ); } inline bool operator != ( double d ) const { return m_f != d2f( d ); } inline bool operator < ( int i ) const { return m_f < i2f( i ); } inline bool operator > ( int i ) const { return m_f > i2f( i ); } inline bool operator <= ( int i ) const { return m_f <= i2f( i ); } inline bool operator >= ( int i ) const { return m_f >= i2f( i ); } inline bool operator == ( int i ) const { return m_f == i2f( i ); } inline bool operator != ( int i ) const { return m_f != i2f( i ); } #if _GCC_TEMPLATE_BUG_ public: #else private: #endif typedef int fix_t; inline static double f2d ( fix_t f ) { return ((double) f ) / ((double) ( 1 << SH )); } inline static fix_t d2f ( double d ) { return (fix_t) ( d * ((double) ( 1 << SH ))); } inline static int f2i ( fix_t f ) { return (int) ( f >> SH ); } inline static fix_t i2f ( int i ) { return (fix_t) ( i << SH ); } inline static fix_t mul ( fix_t m1, fix_t m2 ) { return (fix_t) ((((long long int) m1 ) * m2 ) >> SH ); } inline static fix_t div ( fix_t d1, fix_t d2 ) { return (fix_t) ((((long long int) d1 ) << SH ) / d2 ); } fixed ( fix_t f, bool /*dummy*/ ) : m_f ( f ) { } //data fix_t m_f; // friends: #if !_GCC_TEMPLATE_BUG_ |