diff --git a/doc/cln.texi b/doc/cln.texi index 7d60d9f..47a3bcc 100644 --- a/doc/cln.texi +++ b/doc/cln.texi @@ -157,7 +157,7 @@ Functions on numbers * Functions on floating-point numbers:: * Conversion functions:: * Random number generators:: -* Obfuscating operators:: +* Modifying operators:: Constructing numbers @@ -931,7 +931,7 @@ objects of type @code{cl_I}, it should @code{#include }. * Functions on floating-point numbers:: * Conversion functions:: * Random number generators:: -* Obfuscating operators:: +* Modifying operators:: @end menu @node Constructing numbers @@ -2501,22 +2501,13 @@ if @code{n} is a float. @end table -@node Obfuscating operators -@section Obfuscating operators +@node Modifying operators +@section Modifying operators @cindex modifying operators The modifying C/C++ operators @code{+=}, @code{-=}, @code{*=}, @code{/=}, @code{&=}, @code{|=}, @code{^=}, @code{<<=}, @code{>>=} -are not available by default because their -use tends to make programs unreadable. It is trivial to get away without -them. However, if you feel that you absolutely need these operators -to get happy, then add -@example -#define WANT_OBFUSCATING_OPERATORS -@end example -@cindex @code{WANT_OBFUSCATING_OPERATORS} -to the beginning of your source files, before the inclusion of any CLN -include files. This flag will enable the following operators: +are all available. For the classes @code{cl_N}, @code{cl_R}, @code{cl_RA}, @code{cl_F}, @code{cl_SF}, @code{cl_FF}, @code{cl_DF}, @code{cl_LF}: @@ -2569,7 +2560,7 @@ The prefix operator @code{--x}. The postfix operator @code{x--}. @end table -Note that by using these obfuscating operators, you wouldn't gain efficiency: +Note that by using these modifying operators, you don't gain efficiency: In CLN @samp{x += y;} is exactly the same as @samp{x = x+y;}, not more efficient. diff --git a/include/cln/complex.h b/include/cln/complex.h index dc4aacc..fe74aa4 100644 --- a/include/cln/complex.h +++ b/include/cln/complex.h @@ -138,7 +138,6 @@ extern const cl_N acos (const cl_N& z); extern const cl_N acosh (const cl_N& z); -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_N& operator+= (cl_N& x, const cl_N& y) { return x = x + y; } inline cl_N& operator++ /* prefix */ (cl_N& x) { return x = plus1(x); } @@ -148,7 +147,6 @@ inline cl_N& operator-- /* prefix */ (cl_N& x) { return x = minus1(x); } inline void operator-- /* postfix */ (cl_N& x, int dummy) { (void)dummy; x = minus1(x); } inline cl_N& operator*= (cl_N& x, const cl_N& y) { return x = x * y; } inline cl_N& operator/= (cl_N& x, const cl_N& y) { return x = x / y; } -#endif // Runtime typing support. diff --git a/include/cln/dfloat.h b/include/cln/dfloat.h index de10538..edb8574 100644 --- a/include/cln/dfloat.h +++ b/include/cln/dfloat.h @@ -293,7 +293,6 @@ extern float float_approx (const cl_DF& x); extern double double_approx (const cl_DF& x); -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_DF& operator+= (cl_DF& x, const cl_DF& y) { return x = x + y; } inline cl_DF& operator+= (cl_DF& x, const double y) { return x = x + y; } @@ -307,7 +306,6 @@ inline cl_DF& operator*= (cl_DF& x, const cl_DF& y) { return x = x * y; } inline cl_DF& operator*= (cl_DF& x, const double y) { return x = x * y; } inline cl_DF& operator/= (cl_DF& x, const cl_DF& y) { return x = x / y; } inline cl_DF& operator/= (cl_DF& x, const double y) { return x = x / y; } -#endif /* */ diff --git a/include/cln/ffloat.h b/include/cln/ffloat.h index 1e98cfc..9c150bf 100644 --- a/include/cln/ffloat.h +++ b/include/cln/ffloat.h @@ -293,7 +293,6 @@ extern float float_approx (const cl_FF& x); extern double double_approx (const cl_FF& x); -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_FF& operator+= (cl_FF& x, const cl_FF& y) { return x = x + y; } inline cl_FF& operator+= (cl_FF& x, const float y) { return x = x + y; } @@ -307,7 +306,6 @@ inline cl_FF& operator*= (cl_FF& x, const cl_FF& y) { return x = x * y; } inline cl_FF& operator*= (cl_FF& x, const float y) { return x = x * y; } inline cl_FF& operator/= (cl_FF& x, const cl_FF& y) { return x = x / y; } inline cl_FF& operator/= (cl_FF& x, const float y) { return x = x / y; } -#endif CL_REQUIRE(cl_ieee) diff --git a/include/cln/float.h b/include/cln/float.h index 6bfd2bb..1ab2d3d 100644 --- a/include/cln/float.h +++ b/include/cln/float.h @@ -716,7 +716,6 @@ inline const cl_F random_F (const cl_F& n) { return random_F(default_random_state,n); } -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_F& operator+= (cl_F& x, const cl_F& y) { return x = x + y; } inline cl_F& operator+= (cl_F& x, const float y) { return x = x + y; } @@ -734,7 +733,6 @@ inline cl_F& operator*= (cl_F& x, const double y) { return x = x * y; } inline cl_F& operator/= (cl_F& x, const cl_F& y) { return x = x / y; } inline cl_F& operator/= (cl_F& x, const float y) { return x = x / y; } inline cl_F& operator/= (cl_F& x, const double y) { return x = x / y; } -#endif // Thrown when a floating-point exception occurs. class floating_point_exception : public runtime_exception { diff --git a/include/cln/integer.h b/include/cln/integer.h index d9c3795..2aaf913 100644 --- a/include/cln/integer.h +++ b/include/cln/integer.h @@ -193,12 +193,10 @@ inline const cl_I operator& (const cl_I& x, const cl_I& y) { return logand(x,y); } inline const cl_I operator~ (const cl_I& x) { return lognot(x); } -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_I& operator|= (cl_I& x, const cl_I& y) { return x = x | y; } inline cl_I& operator^= (cl_I& x, const cl_I& y) { return x = x ^ y; } inline cl_I& operator&= (cl_I& x, const cl_I& y) { return x = x & y; } -#endif // Addition/Subtraktion von Integers @@ -616,7 +614,6 @@ inline const cl_I testrandom_I () { return testrandom_I(default_random_state); } -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_I& operator+= (cl_I& x, const cl_I& y) { return x = x + y; } inline cl_I& operator+= (cl_I& x, const int y) { return x = x + y; } @@ -651,7 +648,6 @@ inline const cl_I operator% (const cl_I& x, const cl_I& y) { return rem(x,y); } inline cl_I& operator/= (cl_I& x, const cl_I& y) { return x = x / y; } inline cl_I& operator%= (cl_I& x, const cl_I& y) { return x = x % y; } #endif -#endif // Runtime typing support. diff --git a/include/cln/lfloat.h b/include/cln/lfloat.h index 5327ba4..80801c8 100644 --- a/include/cln/lfloat.h +++ b/include/cln/lfloat.h @@ -407,7 +407,6 @@ extern float float_approx (const cl_LF& x); extern double double_approx (const cl_LF& x); -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_LF& operator+= (cl_LF& x, const cl_LF& y) { return x = x + y; } inline cl_LF& operator++ /* prefix */ (cl_LF& x) { return x = plus1(x); } @@ -417,7 +416,6 @@ inline cl_LF& operator-- /* prefix */ (cl_LF& x) { return x = minus1(x); } inline void operator-- /* postfix */ (cl_LF& x, int dummy) { (void)dummy; x = minus1(x); } inline cl_LF& operator*= (cl_LF& x, const cl_LF& y) { return x = x * y; } inline cl_LF& operator/= (cl_LF& x, const cl_LF& y) { return x = x / y; } -#endif // Runtime typing support. diff --git a/include/cln/rational.h b/include/cln/rational.h index d6864a7..08e558a 100644 --- a/include/cln/rational.h +++ b/include/cln/rational.h @@ -315,7 +315,6 @@ extern float float_approx (const cl_RA& x); extern double double_approx (const cl_RA& x); -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_RA& operator+= (cl_RA& x, const cl_RA& y) { return x = x + y; } inline cl_RA& operator+= (cl_RA& x, const int y) { return x = x + y; } @@ -341,7 +340,6 @@ inline cl_RA& operator-- /* prefix */ (cl_RA& x) { return x = minus1(x); } inline void operator-- /* postfix */ (cl_RA& x, int dummy) { (void)dummy; x = minus1(x); } inline cl_RA& operator*= (cl_RA& x, const cl_RA& y) { return x = x * y; } inline cl_RA& operator/= (cl_RA& x, const cl_RA& y) { return x = x / y; } -#endif // Runtime typing support. diff --git a/include/cln/real.h b/include/cln/real.h index eede270..cfcc631 100644 --- a/include/cln/real.h +++ b/include/cln/real.h @@ -525,7 +525,6 @@ inline const cl_R random_R (const cl_R& n) { return random_R(default_random_state,n); } -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_R& operator+= (cl_R& x, const cl_R& y) { return x = x + y; } inline cl_F& operator+= (cl_F& x, const cl_R& y) { return x = x + y; } @@ -608,7 +607,6 @@ inline cl_F& operator/= (cl_F& x, const unsigned long y) { return x = x / y; } inline cl_F& operator/= (cl_F& x, const long long y) { return x = x / y; } inline cl_F& operator/= (cl_F& x, const unsigned long long y) { return x = x / y; } #endif -#endif // Complex operations, trivial for reals diff --git a/include/cln/sfloat.h b/include/cln/sfloat.h index 396c8da..20348b7 100644 --- a/include/cln/sfloat.h +++ b/include/cln/sfloat.h @@ -273,7 +273,6 @@ extern float float_approx (const cl_SF& x); extern double double_approx (const cl_SF& x); -#ifdef WANT_OBFUSCATING_OPERATORS // This could be optimized to use in-place operations. inline cl_SF& operator+= (cl_SF& x, const cl_SF& y) { return x = x + y; } inline cl_SF& operator++ /* prefix */ (cl_SF& x) { return x = plus1(x); } @@ -283,7 +282,6 @@ inline cl_SF& operator-- /* prefix */ (cl_SF& x) { return x = minus1(x); } inline void operator-- /* postfix */ (cl_SF& x, int dummy) { (void)dummy; x = minus1(x); } inline cl_SF& operator*= (cl_SF& x, const cl_SF& y) { return x = x * y; } inline cl_SF& operator/= (cl_SF& x, const cl_SF& y) { return x = x / y; } -#endif // Runtime typing support.