diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2009-10-29 13:07:21 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2009-10-29 13:07:21 +0000 |
commit | dd6c7cdf8116f6c1b72bf7f5d07d674964296b7b (patch) | |
tree | 0d18d21afb96be635b39b17e93b90ae9da514c4a | |
parent | 584573f9f34ac0835b36ed675ce0fd9afe146686 (diff) | |
download | gcc-dd6c7cdf8116f6c1b72bf7f5d07d674964296b7b.zip gcc-dd6c7cdf8116f6c1b72bf7f5d07d674964296b7b.tar.gz gcc-dd6c7cdf8116f6c1b72bf7f5d07d674964296b7b.tar.bz2 |
decimal: Minor formatting and uglification fixes.
2009-10-29 Paolo Carlini <paolo.carlini@oracle.com>
* include/decimal/decimal: Minor formatting and uglification fixes.
* include/decimal/decimal.h: Likewise.
From-SVN: r153701
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/decimal/decimal | 58 | ||||
-rw-r--r-- | libstdc++-v3/include/decimal/decimal.h | 250 |
3 files changed, 133 insertions, 180 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9bd5891..58148f0 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2009-10-29 Paolo Carlini <paolo.carlini@oracle.com> + + * include/decimal/decimal: Minor formatting and uglification fixes. + * include/decimal/decimal.h: Likewise. + 2009-10-28 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_iterator_base_funcs.h: (next): Change diff --git a/libstdc++-v3/include/decimal/decimal b/libstdc++-v3/include/decimal/decimal index 589b765..8ef5a91 100644 --- a/libstdc++-v3/include/decimal/decimal +++ b/libstdc++-v3/include/decimal/decimal @@ -107,20 +107,20 @@ namespace decimal // 3.2.8 Binary arithmetic operators. #define _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \ - _T1 operator _Op(_T2 lhs, _T3 __rhs); + _T1 operator _Op(_T2 __lhs, _T3 __rhs); #define _DECLARE_DECIMAL_BINARY_OP_WITH_INT(_Op, _Tp) \ - _Tp operator _Op(_Tp lhs, int __rhs); \ - _Tp operator _Op(_Tp lhs, unsigned int __rhs); \ - _Tp operator _Op(_Tp lhs, long __rhs); \ - _Tp operator _Op(_Tp lhs, unsigned long __rhs); \ - _Tp operator _Op(_Tp lhs, long long __rhs); \ - _Tp operator _Op(_Tp lhs, unsigned long long __rhs); \ - _Tp operator _Op(int lhs, _Tp __rhs); \ - _Tp operator _Op(unsigned int lhs, _Tp __rhs); \ - _Tp operator _Op(long lhs, _Tp __rhs); \ - _Tp operator _Op(unsigned long lhs, _Tp __rhs); \ - _Tp operator _Op(long long lhs, _Tp __rhs); \ - _Tp operator _Op(unsigned long long lhs, _Tp __rhs); + _Tp operator _Op(_Tp __lhs, int __rhs); \ + _Tp operator _Op(_Tp __lhs, unsigned int __rhs); \ + _Tp operator _Op(_Tp __lhs, long __rhs); \ + _Tp operator _Op(_Tp __lhs, unsigned long __rhs); \ + _Tp operator _Op(_Tp __lhs, long long __rhs); \ + _Tp operator _Op(_Tp __lhs, unsigned long long __rhs); \ + _Tp operator _Op(int __lhs, _Tp __rhs); \ + _Tp operator _Op(unsigned int __lhs, _Tp __rhs); \ + _Tp operator _Op(long __lhs, _Tp __rhs); \ + _Tp operator _Op(unsigned long __lhs, _Tp __rhs); \ + _Tp operator _Op(long long __lhs, _Tp __rhs); \ + _Tp operator _Op(unsigned long long __lhs, _Tp __rhs); _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32) _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32) @@ -178,22 +178,22 @@ namespace decimal #undef _DECLARE_DECIMAL_BINARY_OP_WITH_INT // 3.2.9 Comparison operators. -#define _DECLARE_DECIMAL_COMPARISON(_Op, _T) \ - bool operator _Op(_T lhs, decimal32 _rhs); \ - bool operator _Op(_T lhs, decimal64 _rhs); \ - bool operator _Op(_T lhs, decimal128 _rhs); \ - bool operator _Op(_T lhs, int _rhs); \ - bool operator _Op(_T lhs, unsigned int _rhs); \ - bool operator _Op(_T lhs, long _rhs); \ - bool operator _Op(_T lhs, unsigned long _rhs); \ - bool operator _Op(_T lhs, long long _rhs); \ - bool operator _Op(_T lhs, unsigned long long _rhs); \ - bool operator _Op(int lhs, _T _rhs); \ - bool operator _Op(unsigned int lhs, _T _rhs); \ - bool operator _Op(long lhs, _T _rhs); \ - bool operator _Op(unsigned long lhs, _T _rhs); \ - bool operator _Op(long long lhs, _T _rhs); \ - bool operator _Op(unsigned long long lhs, _T _rhs); +#define _DECLARE_DECIMAL_COMPARISON(_Op, _Tp) \ + bool operator _Op(_Tp __lhs, decimal32 __rhs); \ + bool operator _Op(_Tp __lhs, decimal64 __rhs); \ + bool operator _Op(_Tp __lhs, decimal128 __rhs); \ + bool operator _Op(_Tp __lhs, int __rhs); \ + bool operator _Op(_Tp __lhs, unsigned int __rhs); \ + bool operator _Op(_Tp __lhs, long __rhs); \ + bool operator _Op(_Tp __lhs, unsigned long __rhs); \ + bool operator _Op(_Tp __lhs, long long __rhs); \ + bool operator _Op(_Tp __lhs, unsigned long long __rhs); \ + bool operator _Op(int __lhs, _Tp __rhs); \ + bool operator _Op(unsigned int __lhs, _Tp __rhs); \ + bool operator _Op(long __lhs, _Tp __rhs); \ + bool operator _Op(unsigned long __lhs, _Tp __rhs); \ + bool operator _Op(long long __lhs, _Tp __rhs); \ + bool operator _Op(unsigned long long __lhs, _Tp __rhs); _DECLARE_DECIMAL_COMPARISON(==, decimal32) _DECLARE_DECIMAL_COMPARISON(==, decimal64) diff --git a/libstdc++-v3/include/decimal/decimal.h b/libstdc++-v3/include/decimal/decimal.h index 002f6ca..64e9b67 100644 --- a/libstdc++-v3/include/decimal/decimal.h +++ b/libstdc++-v3/include/decimal/decimal.h @@ -41,39 +41,39 @@ namespace decimal { // ISO/IEC TR 24733 3.2.[234].1 Construct/copy/destroy. - inline decimal32::decimal32(decimal64 r) : __val(r.__getval()) {} - inline decimal32::decimal32(decimal128 r) : __val(r.__getval()) {} - inline decimal64::decimal64(decimal32 r) : __val(r.__getval()) {} - inline decimal64::decimal64(decimal128 r) : __val(r.__getval()) {} - inline decimal128::decimal128(decimal32 r) : __val(r.__getval()) {} - inline decimal128::decimal128(decimal64 r) : __val(r.__getval()) {} + inline decimal32::decimal32(decimal64 __r) : __val(__r.__getval()) {} + inline decimal32::decimal32(decimal128 __r) : __val(__r.__getval()) {} + inline decimal64::decimal64(decimal32 __r) : __val(__r.__getval()) {} + inline decimal64::decimal64(decimal128 __r) : __val(__r.__getval()) {} + inline decimal128::decimal128(decimal32 __r) : __val(__r.__getval()) {} + inline decimal128::decimal128(decimal64 __r) : __val(__r.__getval()) {} // ISO/IEC TR 24733 3.2.[234].6 Compound assignment. -#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, _T2) \ - inline _T1& _T1::operator _Op1(_T2 __rhs) \ - { \ - __setval(__getval() _Op2 __rhs.__getval()); \ - return *this; \ +#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, _T2) \ + inline _T1& _T1::operator _Op1(_T2 __rhs) \ + { \ + __setval(__getval() _Op2 __rhs.__getval()); \ + return *this; \ } -#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, _T2) \ - inline _T1& _T1::operator _Op1(_T2 __rhs) \ - { \ - __setval(__getval() _Op2 __rhs); \ - return *this; \ +#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, _T2) \ + inline _T1& _T1::operator _Op1(_T2 __rhs) \ + { \ + __setval(__getval() _Op2 __rhs); \ + return *this; \ } -#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(_O1, _O2, _T1) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_O1,_O2,_T1, decimal32) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_O1,_O2,_T1, decimal64) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_O1,_O2,_T1, decimal128) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_O1,_O2,_T1, int) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_O1,_O2,_T1, unsigned int) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_O1,_O2,_T1, long) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_O1,_O2,_T1, unsigned long) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_O1,_O2,_T1, long long) \ - _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_O1,_O2,_T1, unsigned long long) +#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(_Op1, _Op2, _T1) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal32) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal64) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal128) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, int) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned int) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long)\ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long long) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long long) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal32) _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal32) @@ -97,34 +97,22 @@ namespace decimal // Extension: Conversion to integral type. inline long long decimal32_to_long_long(decimal32 __d) - { - return (long long)__d.__getval(); - } + { return (long long)__d.__getval(); } inline long long decimal64_to_long_long(decimal64 __d) - { - return (long long)__d.__getval(); - } + { return (long long)__d.__getval(); } inline long long decimal128_to_long_long(decimal128 __d) - { - return (long long)__d.__getval(); - } + { return (long long)__d.__getval(); } inline long long decimal_to_long_long(decimal32 __d) - { - return (long long)__d.__getval(); - } + { return (long long)__d.__getval(); } inline long long decimal_to_long_long(decimal64 __d) - { - return (long long)__d.__getval(); - } + { return (long long)__d.__getval(); } inline long long decimal_to_long_long(decimal128 __d) - { - return (long long)__d.__getval(); - } + { return (long long)__d.__getval(); } // ISO/IEC TR 24733 3.2.5 Initialization from coefficient and exponent. @@ -140,7 +128,7 @@ namespace decimal else __multiplier = 1.E1DF; - for (int i = 0; i < __exponent; i++) + for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; @@ -158,7 +146,7 @@ namespace decimal else __multiplier = 1.E1DF; - for (int i = 0; i < __exponent; i++) + for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; @@ -176,7 +164,7 @@ namespace decimal else __multiplier = 1.E1DD; - for (int i = 0; i < __exponent; i++) + for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; @@ -194,7 +182,7 @@ namespace decimal else __multiplier = 1.E1DD; - for (int i = 0; i < __exponent; i++) + for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; @@ -212,13 +200,14 @@ namespace decimal else __multiplier = 1.E1DL; - for (int i = 0; i < __exponent; i++) + for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; } - static decimal128 make_decimal128(unsigned long long __coeff, int __exponent) + static decimal128 + make_decimal128(unsigned long long __coeff, int __exponent) { decimal128 __decexp = 1, __multiplier; @@ -230,7 +219,7 @@ namespace decimal else __multiplier = 1.E1DL; - for (int i = 0; i < __exponent; i++) + for (int __i = 0; __i < __exponent; ++__i) __decexp *= __multiplier; return __coeff * __decexp; @@ -239,101 +228,65 @@ namespace decimal // ISO/IEC TR 24733 3.2.6 Conversion to generic floating-point type. inline float decimal32_to_float(decimal32 __d) - { - return (float)__d.__getval(); - } + { return (float)__d.__getval(); } inline float decimal64_to_float(decimal64 __d) - { - return (float)__d.__getval(); - } + { return (float)__d.__getval(); } inline float decimal128_to_float(decimal128 __d) - { - return (float)__d.__getval(); - } + { return (float)__d.__getval(); } inline float decimal_to_float(decimal32 __d) - { - return (float)__d.__getval(); - } + { return (float)__d.__getval(); } inline float decimal_to_float(decimal64 __d) - { - return (float)__d.__getval(); - } + { return (float)__d.__getval(); } inline float decimal_to_float(decimal128 __d) - { - return (float)__d.__getval(); - } + { return (float)__d.__getval(); } inline double decimal32_to_double(decimal32 __d) - { - return (double)__d.__getval(); - } + { return (double)__d.__getval(); } inline double decimal64_to_double(decimal64 __d) - { - return (double)__d.__getval(); - } + { return (double)__d.__getval(); } inline double decimal128_to_double(decimal128 __d) - { - return (double)__d.__getval(); - } + { return (double)__d.__getval(); } inline double decimal_to_double(decimal32 __d) - { - return (double)__d.__getval(); - } + { return (double)__d.__getval(); } inline double decimal_to_double(decimal64 __d) - { - return (double)__d.__getval(); - } + { return (double)__d.__getval(); } inline double decimal_to_double(decimal128 __d) - { - return (double)__d.__getval(); - } + { return (double)__d.__getval(); } inline long double decimal32_to_long_double(decimal32 __d) - { - return (long double)__d.__getval(); - } + { return (long double)__d.__getval(); } inline long double decimal64_to_long_double(decimal64 __d) - { - return (long double)__d.__getval(); - } + { return (long double)__d.__getval(); } inline long double decimal128_to_long_double(decimal128 __d) - { - return (long double)__d.__getval(); - } + { return (long double)__d.__getval(); } inline long double decimal_to_long_double(decimal32 __d) - { - return (long double)__d.__getval(); - } + { return (long double)__d.__getval(); } inline long double decimal_to_long_double(decimal64 __d) - { - return (long double)__d.__getval(); - } + { return (long double)__d.__getval(); } inline long double decimal_to_long_double(decimal128 __d) - { - return (long double)__d.__getval(); - } + { return (long double)__d.__getval(); } // ISO/IEC TR 24733 3.2.7 Unary arithmetic operators. -#define _DEFINE_DECIMAL_UNARY_OP(_Op, _T) \ - inline _T operator _Op(_T __rhs) \ +#define _DEFINE_DECIMAL_UNARY_OP(_Op, _Tp) \ + inline _Tp operator _Op(_Tp __rhs) \ { \ - _T __tmp; \ + _Tp __tmp; \ __tmp.__setval(0 _Op __rhs.__getval()); \ return __tmp; \ } @@ -350,50 +303,50 @@ namespace decimal // ISO/IEC TR 24733 3.2.8 Binary arithmetic operators. #define _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \ - inline _T1 operator _Op(_T2 lhs, _T3 __rhs) \ + inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \ { \ - _T1 retval; \ - retval.__setval(lhs.__getval() _Op __rhs.__getval()); \ - return retval; \ + _T1 __retval; \ + __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \ + return __retval; \ } #define _DEFINE_DECIMAL_BINARY_OP_BOTH(_Op, _T1, _T2, _T3) \ - inline _T1 operator _Op(_T2 lhs, _T3 __rhs) \ + inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \ { \ - _T1 retval; \ - retval.__setval(lhs.__getval() _Op __rhs.__getval()); \ - return retval; \ + _T1 __retval; \ + __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \ + return __retval; \ } #define _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, _T2) \ - inline _T1 operator _Op(_T1 lhs, _T2 __rhs) \ + inline _T1 operator _Op(_T1 __lhs, _T2 __rhs) \ { \ - _T1 retval; \ - retval.__setval(lhs.__getval() _Op __rhs); \ - return retval; \ + _T1 __retval; \ + __retval.__setval(__lhs.__getval() _Op __rhs); \ + return __retval; \ } #define _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, _T2) \ - inline _T1 operator _Op(_T2 lhs, _T1 __rhs) \ + inline _T1 operator _Op(_T2 __lhs, _T1 __rhs) \ { \ - _T1 retval; \ - retval.__setval(lhs _Op __rhs.__getval()); \ - return retval; \ - } - -#define _DEFINE_DECIMAL_BINARY_OP_WITH_INT(_Op,_Tp) \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op,_Tp, int); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op,_Tp, unsigned int); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op,_Tp, long); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op,_Tp, unsigned long); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op,_Tp, long long); \ - _DEFINE_DECIMAL_BINARY_OP_LHS(_Op,_Tp, unsigned long long); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op,_Tp, int); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op,_Tp, unsigned int); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op,_Tp, long); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op,_Tp, unsigned long); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op,_Tp, long long); \ - _DEFINE_DECIMAL_BINARY_OP_RHS(_Op,_Tp, unsigned long long); \ + _T1 __retval; \ + __retval.__setval(__lhs _Op __rhs.__getval()); \ + return __retval; \ + } + +#define _DEFINE_DECIMAL_BINARY_OP_WITH_INT(_Op, _T1) \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, int); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned int); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long long); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long long); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, int); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned int); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long long); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long long); \ _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32) _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32) @@ -456,21 +409,16 @@ namespace decimal // ISO/IEC TR 24733 3.2.9 Comparison operators. #define _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _T1, _T2) \ - inline bool operator _Op(_T1 lhs, _T2 __rhs) \ - { \ - return lhs.__getval() _Op __rhs.__getval(); \ - } + inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ + { return __lhs.__getval() _Op __rhs.__getval(); } #define _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _T1, _T2) \ - inline bool operator _Op(_T1 lhs, _T2 __rhs) \ - { \ - return lhs.__getval() _Op __rhs; \ - } + inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ + { return __lhs.__getval() _Op __rhs; } + #define _DEFINE_DECIMAL_COMPARISON_RHS(_Op, _T1, _T2) \ - inline bool operator _Op(_T1 lhs, _T2 __rhs) \ - { \ - return lhs _Op __rhs.__getval(); \ - } + inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ + { return __lhs _Op __rhs.__getval(); } #define _DEFINE_DECIMAL_COMPARISONS(_Op, _Tp) \ _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal32) \ |