From bd2f4302b76ff0dd4cf382c65381fff651e2487d Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Sun, 18 Oct 2020 00:23:28 +0200 Subject: [PATCH] Assume types 'long long int' and 'long double' exist. The C++11 standard requires in 3.9.1-2 that type 'long long int' exists and in -8 that type 'long double' exists. So, remove macros HAVE_LONGLONG and HAVE_LONGDOUBLE. Also, shamelessly update m4/param.m4, m4/intparam.m4, and m4/floatparam.m4 with code from CLisp. All this fixes several cross-compilation issues discovered by Helmut Grohne . --- autoconf/floatparam.c | 10 +- autoconf/intparam.c | 35 +------ configure.ac | 5 - include/cln/complex_class.h | 6 -- include/cln/config.h.in | 7 -- include/cln/float.h | 16 --- include/cln/integer.h | 12 --- include/cln/integer_class.h | 6 -- include/cln/io.h | 4 - include/cln/lfloat.h | 8 -- include/cln/number.h | 8 -- include/cln/object.h | 2 - include/cln/rational.h | 20 ---- include/cln/rational_class.h | 6 -- include/cln/real.h | 30 ------ include/cln/real_class.h | 6 -- include/cln/types.h | 22 ++--- m4/floatparam.m4 | 89 +++++++++++------ m4/intparam.m4 | 145 +++++++++++++--------------- m4/longdouble.m4 | 31 ------ m4/longlong.m4 | 42 -------- m4/param.m4 | 68 ++++++------- src/base/cl_low.h | 10 +- src/base/digit/cl_D.h | 4 +- src/base/digitseq/cl_DS_mul_fftc.h | 2 +- src/base/digitseq/cl_DS_mul_fftcs.h | 2 +- src/base/digitseq/cl_DS_mul_fftr.h | 2 +- src/base/low/cl_low_isqrt.cc | 2 - src/base/output/cl_output_dec.cc | 4 - src/base/output/cl_output_hex.cc | 4 - 30 files changed, 174 insertions(+), 434 deletions(-) delete mode 100644 m4/longdouble.m4 delete mode 100644 m4/longlong.m4 diff --git a/autoconf/floatparam.c b/autoconf/floatparam.c index 66b4d61..db3e626 100644 --- a/autoconf/floatparam.c +++ b/autoconf/floatparam.c @@ -9,9 +9,7 @@ typedef int boolean; #define TRUE 1 #define FALSE 0 -#ifdef HAVE_LONGDOUBLE typedef long double ldouble; -#endif static void header (void) { @@ -81,9 +79,7 @@ static boolean equalfn (volatile type* x, volatile type* y) \ check(float,"float","float",equal_float,main_float) check(double,"double","double",equal_double,main_double) -#ifdef HAVE_LONGDOUBLE check(ldouble,"long_double","long double",equal_ldouble,main_ldouble) -#endif /* Some systems (arm/linux) store doubles as little endian but with higher * and lower word reversed. */ @@ -104,14 +100,12 @@ static void flipped_double (void) printf("\n"); } -int main() -{ +int main(int argc, char *argv[]) +{ if (freopen(argc==1 ? "conftest.h" : argv[1], "w", stdout) == NULL) return 1; header(); main_float(); main_double(); -#ifdef HAVE_LONGDOUBLE main_ldouble(); -#endif flipped_double(); if (ferror(stdout) || fclose(stdout)) return 1; diff --git a/autoconf/intparam.c b/autoconf/intparam.c index 7988265..66cce71 100644 --- a/autoconf/intparam.c +++ b/autoconf/intparam.c @@ -32,10 +32,8 @@ typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned /* int */ uint; typedef unsigned long ulong; -#ifdef HAVE_LONGLONG typedef long long longlong; typedef unsigned long long ulonglong; -#endif typedef int (function)(); static int random_table[256] = /* 2048 zufällige Bits, hier von pi */ @@ -87,10 +85,8 @@ static int char_bitsize, short_bitsize, int_bitsize, long_bitsize; static int uchar_bitsize, ushort_bitsize, uint_bitsize, ulong_bitsize; static boolean char_uchar_same, short_ushort_same, int_uint_same, long_ulong_same; static int pointer_bitsize; -#ifdef HAVE_LONGLONG static int longlong_bitsize, ulonglong_bitsize; static boolean longlong_ulonglong_same; -#endif void main1(void) { #define get_unsigned_integer_bitsize(type,where) \ @@ -140,10 +136,8 @@ void main1(void) { print_integer_bitsize(short,"short",short_bitsize); print_integer_bitsize(int,"int",int_bitsize); print_integer_bitsize(long,"long",long_bitsize); -#ifdef HAVE_LONGLONG get_signed_integer_bitsize(longlong,ulonglong,longlong_bitsize); print_integer_bitsize(longlong,"long long",longlong_bitsize); -#endif get_unsigned_integer_bitsize(uchar,uchar_bitsize); get_unsigned_integer_bitsize(ushort,ushort_bitsize); get_unsigned_integer_bitsize(uint,uint_bitsize); @@ -152,10 +146,8 @@ void main1(void) { print_integer_bitsize(ushort,"unsigned short",ushort_bitsize); print_integer_bitsize(uint,"unsigned int",uint_bitsize); print_integer_bitsize(ulong,"unsigned long",ulong_bitsize); -#ifdef HAVE_LONGLONG get_unsigned_integer_bitsize(ulonglong,ulonglong_bitsize); print_integer_bitsize(ulonglong,"unsigned long long",ulonglong_bitsize); -#endif } void main2(void) { @@ -167,9 +159,7 @@ void main2(void) { compare_integer_bitsizes("short","unsigned short",short_bitsize,ushort_bitsize); compare_integer_bitsizes("int","unsigned int",int_bitsize,uint_bitsize); compare_integer_bitsizes("long","unsigned long",long_bitsize,ulong_bitsize); -#ifdef HAVE_LONGLONG compare_integer_bitsizes("long long","unsigned long long",longlong_bitsize,ulonglong_bitsize); -#endif } #define get_a_random(type,bitsize,where) \ @@ -221,9 +211,7 @@ void main3(void) { compare_integer_representation(short,ushort,"short","unsigned short",short_bitsize,ushort_bitsize,short_ushort_same); compare_integer_representation(int,uint,"int","unsigned int",int_bitsize,uint_bitsize,int_uint_same); compare_integer_representation(long,ulong,"long","unsigned long",long_bitsize,ulong_bitsize,long_ulong_same); -#ifdef HAVE_LONGLONG compare_integer_representation(longlong,ulonglong,"long long","unsigned long long",longlong_bitsize,ulonglong_bitsize,longlong_ulonglong_same); -#endif printf("\n"); } @@ -296,16 +284,12 @@ void main4(void) { test_integer_ushift(ushort,"unsigned short",ushort_bitsize); test_integer_ushift(uint,"unsigned int",uint_bitsize); test_integer_ushift(ulong,"unsigned long",ulong_bitsize); -#ifdef HAVE_LONGLONG test_integer_ushift(ulonglong,"unsigned long long",ulonglong_bitsize); -#endif test_integer_sshift(schar,"char",char_bitsize); test_integer_sshift(short,"short",short_bitsize); test_integer_sshift(int,"int",int_bitsize); test_integer_sshift(long,"long",long_bitsize); -#ifdef HAVE_LONGLONG test_integer_sshift(longlong,"long long",longlong_bitsize); -#endif } void main5(void) { @@ -357,10 +341,8 @@ void main5(void) { test_integer_casts(ushort,short,"unsigned short","short",ushort_bitsize,short_bitsize,0); test_integer_casts(uint,int,"unsigned int","int",uint_bitsize,int_bitsize,0); test_integer_casts(ulong,long,"unsigned long","long",ulong_bitsize,long_bitsize,0); -#ifdef HAVE_LONGLONG test_integer_casts(longlong,ulonglong,"long long","unsigned long long",longlong_bitsize,ulonglong_bitsize,0); test_integer_casts(ulonglong,longlong,"unsigned long long","long long",ulonglong_bitsize,longlong_bitsize,0); -#endif /* dann Casts zwischen Integers unterschiedlicher Größe, aber gleichen Vorzeichens: */ test_integer_casts(uchar,ushort,"unsigned char","unsigned short",uchar_bitsize,ushort_bitsize,1); test_integer_casts(uchar,uint,"unsigned char","unsigned int",uchar_bitsize,uint_bitsize,1); @@ -368,24 +350,20 @@ void main5(void) { test_integer_casts(ushort,uint,"unsigned short","unsigned int",ushort_bitsize,uint_bitsize,1); test_integer_casts(ushort,ulong,"unsigned short","unsigned long",ushort_bitsize,ulong_bitsize,1); test_integer_casts(uint,ulong,"unsigned int","unsigned long",uint_bitsize,ulong_bitsize,1); -#ifdef HAVE_LONGLONG test_integer_casts(uchar,ulonglong,"unsigned char","unsigned long long",uchar_bitsize,ulonglong_bitsize,1); test_integer_casts(ushort,ulonglong,"unsigned short","unsigned long long",ushort_bitsize,ulonglong_bitsize,1); test_integer_casts(uint,ulonglong,"unsigned int","unsigned long long",uint_bitsize,ulonglong_bitsize,1); test_integer_casts(ulong,ulonglong,"unsigned long","unsigned long long",ulong_bitsize,ulonglong_bitsize,1); -#endif test_integer_casts(schar,short,"char","short",char_bitsize,short_bitsize,2); test_integer_casts(schar,int,"char","int",char_bitsize,int_bitsize,2); test_integer_casts(schar,long,"char","long",char_bitsize,long_bitsize,2); test_integer_casts(short,int,"short","int",short_bitsize,int_bitsize,2); test_integer_casts(short,long,"short","long",short_bitsize,long_bitsize,2); test_integer_casts(int,long,"int","long",int_bitsize,long_bitsize,2); -#ifdef HAVE_LONGLONG test_integer_casts(schar,longlong,"char","long long",char_bitsize,longlong_bitsize,2); test_integer_casts(short,longlong,"short","long long",short_bitsize,longlong_bitsize,2); test_integer_casts(int,longlong,"int","long long",int_bitsize,longlong_bitsize,2); test_integer_casts(long,longlong,"long","long long",long_bitsize,longlong_bitsize,2); -#endif /* dann Casts zwischen Integers unterschiedlicher Größe und unterschiedlichen Vorzeichens: */ test_integer_casts(uchar,short,"unsigned char","short",uchar_bitsize,short_bitsize,1); test_integer_casts(uchar,int,"unsigned char","int",uchar_bitsize,int_bitsize,1); @@ -393,24 +371,20 @@ void main5(void) { test_integer_casts(ushort,int,"unsigned short","int",ushort_bitsize,int_bitsize,1); test_integer_casts(ushort,long,"unsigned short","long",ushort_bitsize,long_bitsize,1); test_integer_casts(uint,long,"unsigned int","long",uint_bitsize,long_bitsize,1); -#ifdef HAVE_LONGLONG test_integer_casts(uchar,longlong,"unsigned char","long long",uchar_bitsize,longlong_bitsize,1); test_integer_casts(ushort,longlong,"unsigned short","long long",ushort_bitsize,longlong_bitsize,1); test_integer_casts(uint,longlong,"unsigned int","long long",uint_bitsize,longlong_bitsize,1); test_integer_casts(ulong,longlong,"unsigned long","long long",ulong_bitsize,longlong_bitsize,1); -#endif test_integer_casts(schar,ushort,"char","unsigned short",char_bitsize,ushort_bitsize,2); test_integer_casts(schar,uint,"char","unsigned int",char_bitsize,uint_bitsize,2); test_integer_casts(schar,ulong,"char","unsigned long",char_bitsize,ulong_bitsize,2); test_integer_casts(short,uint,"short","unsigned int",short_bitsize,uint_bitsize,2); test_integer_casts(short,ulong,"short","unsigned long",short_bitsize,ulong_bitsize,2); test_integer_casts(int,ulong,"int","unsigned long",int_bitsize,ulong_bitsize,2); -#ifdef HAVE_LONGLONG test_integer_casts(schar,ulonglong,"char","unsigned long long",char_bitsize,ulonglong_bitsize,2); test_integer_casts(short,ulonglong,"short","unsigned long long",short_bitsize,ulonglong_bitsize,2); test_integer_casts(int,ulonglong,"int","unsigned long long",int_bitsize,ulonglong_bitsize,2); test_integer_casts(long,ulonglong,"long","unsigned long long",long_bitsize,ulonglong_bitsize,2); -#endif } void main6(void) { @@ -486,9 +460,7 @@ void main8(void) { get_alignment(short,"short"); get_alignment(ushort,"unsigned short"); get_alignment(int,"int"); get_alignment(uint,"unsigned int"); get_alignment(long,"long"); get_alignment(ulong,"unsigned long"); -#ifdef HAVE_LONGLONG get_alignment(longlong,"long long"); get_alignment(ulonglong,"unsigned long long"); -#endif get_alignment(float,"float"); get_alignment(double,"double"); get_alignment(char*,"char *"); @@ -534,9 +506,7 @@ void main9(void) { get_endian(ushort,"unsigned short",ushort_bitsize); get_endian(uint,"unsigned int",uint_bitsize); get_endian(ulong,"unsigned long",ulong_bitsize); -#ifdef HAVE_LONGLONG get_endian(ulonglong,"unsigned long long",ulonglong_bitsize); -#endif printf("\n"); } @@ -568,8 +538,9 @@ void main10(void) printf("#error \"Unknown stack model -- incorrect C semantics!!\"\n"); } -int main() -{ main1(); +int main(int argc, char *argv[]) +{ if (freopen(argc==1 ? "conftest.h" : argv[1], "w", stdout) == NULL) return 1; + main1(); main2(); main3(); main4(); diff --git a/configure.ac b/configure.ac index 88944b0..bdd21dc 100644 --- a/configure.ac +++ b/configure.ac @@ -92,11 +92,6 @@ dnl AC_LANG([C++]) AX_CXX_COMPILE_STDCXX([11], [ext], [optional]) dnl -CL_LONGLONG - dnl DEFS HAVE_LONGLONG -CL_LONGDOUBLE - dnl DEFS HAVE_LONGDOUBLE -dnl dnl checks for header files dnl AC_CHECK_HEADERS([unistd.h]) diff --git a/include/cln/complex_class.h b/include/cln/complex_class.h index 4e7a774..54cbcf3 100644 --- a/include/cln/complex_class.h +++ b/include/cln/complex_class.h @@ -21,10 +21,8 @@ public: cl_N (const unsigned int); // argument must be < 2^29 cl_N (const long); cl_N (const unsigned long); -#ifdef HAVE_LONGLONG cl_N (const long long); cl_N (const unsigned long long); -#endif cl_N (const float); cl_N (const double); cl_N& operator= (const int); // |argument| must be < 2^29 @@ -33,10 +31,8 @@ public: cl_N& operator= (const unsigned long); cl_N& operator= (const float); cl_N& operator= (const double); -#ifdef HAVE_LONGLONG cl_N& operator= (const long long); cl_N& operator= (const unsigned long long); -#endif // Other constructors. cl_N (const char *); // Private constructor. @@ -64,10 +60,8 @@ CL_DEFINE_INT_CONSTRUCTORS(cl_N) CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_N) CL_DEFINE_LONG_CONSTRUCTORS(cl_N) CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_N) -#ifdef HAVE_LONGLONG CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_N) CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_N) -#endif CL_DEFINE_FLOAT_CONSTRUCTOR(cl_N) CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_N) diff --git a/include/cln/config.h.in b/include/cln/config.h.in index 511d534..78215ce 100644 --- a/include/cln/config.h.in +++ b/include/cln/config.h.in @@ -4,13 +4,6 @@ #include "cln/host_cpu.h" #include "cln/version.h" -/* - * FIXME: this should not be exposed to user. Or at least it should be - * renamed to CL_HAVE_LONGLONG or something like that. - */ -/* compiler supports the `long long' type */ -#undef HAVE_LONGLONG - /* * Numbers in the heap are stored as "digit" (or "limb" in GMP speak) * sequences. A digit is an unsigned int with sizeof(void *)*CHAR_BIT bits. diff --git a/include/cln/float.h b/include/cln/float.h index e3e953f..0af74e5 100644 --- a/include/cln/float.h +++ b/include/cln/float.h @@ -173,12 +173,10 @@ inline const cl_F operator+ (const long x, const cl_F& y) { return cl_I(x) + y; } inline const cl_F operator+ (const unsigned long x, const cl_F& y) { return cl_I(x) + y; } -#ifdef HAVE_LONGLONG inline const cl_F operator+ (const long long x, const cl_F& y) { return cl_I(x) + y; } inline const cl_F operator+ (const unsigned long long x, const cl_F& y) { return cl_I(x) + y; } -#endif inline const cl_F operator+ (const float x, const cl_F& y) { return cl_F(x) + y; } inline const cl_F operator+ (const double x, const cl_F& y) @@ -191,12 +189,10 @@ inline const cl_F operator+ (const cl_F& x, const long y) { return x + cl_I(y); } inline const cl_F operator+ (const cl_F& x, const unsigned long y) { return x + cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_F operator+ (const cl_F& x, const long long y) { return x + cl_I(y); } inline const cl_F operator+ (const cl_F& x, const unsigned long long y) { return x + cl_I(y); } -#endif inline const cl_F operator+ (const cl_F& x, const float y) { return x + cl_F(y); } inline const cl_F operator+ (const cl_F& x, const double y) @@ -222,12 +218,10 @@ inline const cl_F operator- (const long x, const cl_F& y) { return cl_I(x) - y; } inline const cl_F operator- (const unsigned long x, const cl_F& y) { return cl_I(x) - y; } -#ifdef HAVE_LONGLONG inline const cl_F operator- (const long long x, const cl_F& y) { return cl_I(x) - y; } inline const cl_F operator- (const unsigned long long x, const cl_F& y) { return cl_I(x) - y; } -#endif inline const cl_F operator- (const float x, const cl_F& y) { return cl_F(x) - y; } inline const cl_F operator- (const double x, const cl_F& y) @@ -240,12 +234,10 @@ inline const cl_F operator- (const cl_F& x, const long y) { return x - cl_I(y); } inline const cl_F operator- (const cl_F& x, const unsigned long y) { return x - cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_F operator- (const cl_F& x, const long long y) { return x - cl_I(y); } inline const cl_F operator- (const cl_F& x, const unsigned long long y) { return x - cl_I(y); } -#endif inline const cl_F operator- (const cl_F& x, const float y) { return x - cl_F(y); } inline const cl_F operator- (const cl_F& x, const double y) @@ -283,12 +275,10 @@ inline const cl_R operator* (const long x, const cl_F& y) { return cl_I(x) * y; } inline const cl_R operator* (const unsigned long x, const cl_F& y) { return cl_I(x) * y; } -#ifdef HAVE_LONGLONG inline const cl_R operator* (const long long x, const cl_F& y) { return cl_I(x) * y; } inline const cl_R operator* (const unsigned long long x, const cl_F& y) { return cl_I(x) * y; } -#endif inline const cl_F operator* (const float x, const cl_F& y) { return cl_F(x) * y; } inline const cl_F operator* (const double x, const cl_F& y) @@ -301,12 +291,10 @@ inline const cl_R operator* (const cl_F& x, const long y) { return x * cl_I(y); } inline const cl_R operator* (const cl_F& x, const unsigned long y) { return x * cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_R operator* (const cl_F& x, const long long y) { return x * cl_I(y); } inline const cl_R operator* (const cl_F& x, const unsigned long long y) { return x * cl_I(y); } -#endif inline const cl_F operator* (const cl_F& x, const float y) { return x * cl_F(y); } inline const cl_F operator* (const cl_F& x, const double y) @@ -331,12 +319,10 @@ inline const cl_F operator/ (const cl_F& x, const long y) { return x / cl_I(y); } inline const cl_F operator/ (const cl_F& x, const unsigned long y) { return x / cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_F operator/ (const cl_F& x, const long long y) { return x / cl_I(y); } inline const cl_F operator/ (const cl_F& x, const unsigned long long y) { return x / cl_I(y); } -#endif inline const cl_F operator/ (const cl_F& x, const float y) { return x / cl_F(y); } inline const cl_F operator/ (const cl_F& x, const double y) @@ -349,12 +335,10 @@ inline const cl_R operator/ (const long x, const cl_F& y) { return cl_I(x) / y; } inline const cl_R operator/ (const unsigned long x, const cl_F& y) { return cl_I(x) / y; } -#ifdef HAVE_LONGLONG inline const cl_R operator/ (const long long x, const cl_F& y) { return cl_I(x) / y; } inline const cl_R operator/ (const unsigned long long x, const cl_F& y) { return cl_I(x) / y; } -#endif inline const cl_F operator/ (const float x, const cl_F& y) { return cl_F(x) / y; } inline const cl_F operator/ (const double x, const cl_F& y) diff --git a/include/cln/integer.h b/include/cln/integer.h index 081caf2..7b95efd 100644 --- a/include/cln/integer.h +++ b/include/cln/integer.h @@ -218,12 +218,10 @@ inline const cl_I operator+ (const long x, const cl_I& y) { return cl_I(x) + y; } inline const cl_I operator+ (const unsigned long x, const cl_I& y) { return cl_I(x) + y; } -#ifdef HAVE_LONGLONG inline const cl_I operator+ (const long long x, const cl_I& y) { return cl_I(x) + y; } inline const cl_I operator+ (const unsigned long long x, const cl_I& y) { return cl_I(x) + y; } -#endif inline const cl_I operator+ (const cl_I& x, const int y) { return x + cl_I(y); } inline const cl_I operator+ (const cl_I& x, const unsigned int y) @@ -232,12 +230,10 @@ inline const cl_I operator+ (const cl_I& x, const long y) { return x + cl_I(y); } inline const cl_I operator+ (const cl_I& x, const unsigned long y) { return x + cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_I operator+ (const cl_I& x, const long long y) { return x + cl_I(y); } inline const cl_I operator+ (const cl_I& x, const unsigned long long y) { return x + cl_I(y); } -#endif // (- x), wenn x ein Integer ist. Ergebnis Integer. extern const cl_I operator- (const cl_I& x); @@ -253,12 +249,10 @@ inline const cl_I operator- (const long x, const cl_I& y) { return cl_I(x) - y; } inline const cl_I operator- (const unsigned long x, const cl_I& y) { return cl_I(x) - y; } -#ifdef HAVE_LONGLONG inline const cl_I operator- (const long long x, const cl_I& y) { return cl_I(x) - y; } inline const cl_I operator- (const unsigned long long x, const cl_I& y) { return cl_I(x) - y; } -#endif inline const cl_I operator- (const cl_I& x, const int y) { return x - cl_I(y); } inline const cl_I operator- (const cl_I& x, const unsigned int y) @@ -267,12 +261,10 @@ inline const cl_I operator- (const cl_I& x, const long y) { return x - cl_I(y); } inline const cl_I operator- (const cl_I& x, const unsigned long y) { return x - cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_I operator- (const cl_I& x, const long long y) { return x - cl_I(y); } inline const cl_I operator- (const cl_I& x, const unsigned long long y) { return x - cl_I(y); } -#endif // (abs x), wenn x ein Integer ist. Ergebnis Integer. extern const cl_I abs (const cl_I& x); @@ -361,12 +353,10 @@ inline const cl_I operator* (const long x, const cl_I& y) { return cl_I(x) * y; } inline const cl_I operator* (const unsigned long x, const cl_I& y) { return cl_I(x) * y; } -#ifdef HAVE_LONGLONG inline const cl_I operator* (const long long x, const cl_I& y) { return cl_I(x) * y; } inline const cl_I operator* (const unsigned long long x, const cl_I& y) { return cl_I(x) * y; } -#endif inline const cl_I operator* (const cl_I& x, const int y) { return x * cl_I(y); } inline const cl_I operator* (const cl_I& x, const unsigned int y) @@ -375,12 +365,10 @@ inline const cl_I operator* (const cl_I& x, const long y) { return x * cl_I(y); } inline const cl_I operator* (const cl_I& x, const unsigned long y) { return x * cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_I operator* (const cl_I& x, const long long y) { return x * cl_I(y); } inline const cl_I operator* (const cl_I& x, const unsigned long long y) { return x * cl_I(y); } -#endif // (EXPT x 2), wo x Integer ist. extern const cl_I square (const cl_I& x); diff --git a/include/cln/integer_class.h b/include/cln/integer_class.h index 23f5632..6c99bda 100644 --- a/include/cln/integer_class.h +++ b/include/cln/integer_class.h @@ -21,18 +21,14 @@ public: cl_I (const unsigned int); // argument must be < 2^29 cl_I (const long); cl_I (const unsigned long); -#ifdef HAVE_LONGLONG cl_I (const long long); cl_I (const unsigned long long); -#endif cl_I& operator= (const int); // |argument| must be < 2^29 cl_I& operator= (const unsigned int); // argument must be < 2^29 cl_I& operator= (const long); cl_I& operator= (const unsigned long); -#ifdef HAVE_LONGLONG cl_I& operator= (const long long); cl_I& operator= (const unsigned long long); -#endif // Other constructors. cl_I (const char *); // Private constructor. @@ -59,10 +55,8 @@ CL_DEFINE_INT_CONSTRUCTORS(cl_I) CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_I) CL_DEFINE_LONG_CONSTRUCTORS(cl_I) CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_I) -#ifdef HAVE_LONGLONG CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_I) CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_I) -#endif } // namespace cln diff --git a/include/cln/io.h b/include/cln/io.h index 45abfda..df9efcb 100644 --- a/include/cln/io.h +++ b/include/cln/io.h @@ -43,10 +43,8 @@ extern void fprintdecimal (std::ostream& stream, int x); extern void fprintdecimal (std::ostream& stream, unsigned long x); extern void fprintdecimal (std::ostream& stream, long x); -#ifdef HAVE_LONGLONG extern void fprintdecimal (std::ostream& stream, unsigned long long x); extern void fprintdecimal (std::ostream& stream, long long x); -#endif extern void fprinthexadecimal (std::ostream& stream, unsigned int x); extern void fprinthexadecimal (std::ostream& stream, int x); @@ -54,10 +52,8 @@ extern void fprinthexadecimal (std::ostream& stream, int x); extern void fprinthexadecimal (std::ostream& stream, unsigned long x); extern void fprinthexadecimal (std::ostream& stream, long x); -#ifdef HAVE_LONGLONG extern void fprinthexadecimal (std::ostream& stream, unsigned long long x); extern void fprinthexadecimal (std::ostream& stream, long long x); -#endif struct cl_print_flags; diff --git a/include/cln/lfloat.h b/include/cln/lfloat.h index 80801c8..d619ec3 100644 --- a/include/cln/lfloat.h +++ b/include/cln/lfloat.h @@ -83,12 +83,10 @@ inline const cl_R operator* (const long x, const cl_LF& y) { return cl_I(x) * y; } inline const cl_R operator* (const unsigned long x, const cl_LF& y) { return cl_I(x) * y; } -#ifdef HAVE_LONGLONG inline const cl_R operator* (const long long x, const cl_LF& y) { return cl_I(x) * y; } inline const cl_R operator* (const unsigned long long x, const cl_LF& y) { return cl_I(x) * y; } -#endif inline const cl_R operator* (const cl_LF& x, const int y) { return x * cl_I(y); } inline const cl_R operator* (const cl_LF& x, const unsigned int y) @@ -97,12 +95,10 @@ inline const cl_R operator* (const cl_LF& x, const long y) { return x * cl_I(y); } inline const cl_R operator* (const cl_LF& x, const unsigned long y) { return x * cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_R operator* (const cl_LF& x, const long long y) { return x * cl_I(y); } inline const cl_R operator* (const cl_LF& x, const unsigned long long y) { return x * cl_I(y); } -#endif // Spezialfall x = y. // Liefert zu einem Long-Float x : (* x x), ein LF. extern const cl_LF square (const cl_LF& x); @@ -139,12 +135,10 @@ inline const cl_LF operator/ (const cl_LF& x, const long y) { return x / cl_I(y); } inline const cl_LF operator/ (const cl_LF& x, const unsigned long y) { return x / cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_LF operator/ (const cl_LF& x, const long long y) { return x / cl_I(y); } inline const cl_LF operator/ (const cl_LF& x, const unsigned long long y) { return x / cl_I(y); } -#endif inline const cl_R operator/ (const int x, const cl_LF& y) { return cl_I(x) / y; } inline const cl_R operator/ (const unsigned int x, const cl_LF& y) @@ -153,12 +147,10 @@ inline const cl_R operator/ (const long x, const cl_LF& y) { return cl_I(x) / y; } inline const cl_R operator/ (const unsigned long x, const cl_LF& y) { return cl_I(x) / y; } -#ifdef HAVE_LONGLONG inline const cl_R operator/ (const long long x, const cl_LF& y) { return cl_I(x) / y; } inline const cl_R operator/ (const unsigned long long x, const cl_LF& y) { return cl_I(x) / y; } -#endif // Liefert zu einem Long-Float x>=0 : (sqrt x), ein LF. extern const cl_LF sqrt (const cl_LF& x); diff --git a/include/cln/number.h b/include/cln/number.h index 8abb22b..67f6889 100644 --- a/include/cln/number.h +++ b/include/cln/number.h @@ -121,7 +121,6 @@ inline _class_& _class_::operator= (const unsigned long wert) \ } #endif -#ifdef HAVE_LONGLONG #if (long_long_bitsize==64) // `long' == `sintQ', `unsigned long' == `uintQ'. #define CL_DEFINE_LONGLONG_CONSTRUCTORS(_class_) \ @@ -151,7 +150,6 @@ inline _class_& _class_::operator= (const unsigned long long wert) \ return *this; \ } #endif -#endif namespace cln { @@ -205,10 +203,8 @@ public: cl_number (const unsigned int); // argument must be < 2^29 cl_number (const long); cl_number (const unsigned long); -#ifdef HAVE_LONGLONG cl_number (const long long); cl_number (const unsigned long long); -#endif cl_number (const float); cl_number (const double); cl_number& operator= (const int); // |argument| must be < 2^29 @@ -217,10 +213,8 @@ public: cl_number& operator= (const unsigned long); cl_number& operator= (const float); cl_number& operator= (const double); -#ifdef HAVE_LONGLONG cl_number& operator= (const long long); cl_number& operator= (const unsigned long long); -#endif // Other constructors. // cl_number (const char *); // Private pointer manipulations. @@ -241,10 +235,8 @@ CL_DEFINE_INT_CONSTRUCTORS(cl_number) CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_number) CL_DEFINE_LONG_CONSTRUCTORS(cl_number) CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_number) -#ifdef HAVE_LONGLONG CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_number) CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_number) -#endif CL_DEFINE_FLOAT_CONSTRUCTOR(cl_number) CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_number) diff --git a/include/cln/object.h b/include/cln/object.h index f6da29f..e8c1b9d 100644 --- a/include/cln/object.h +++ b/include/cln/object.h @@ -128,12 +128,10 @@ inline cl_uint cl_combine (cl_uint tag, unsigned long value) { return cl_combine_impl(tag, (cl_uint)value); } inline cl_uint cl_combine (cl_uint tag, long value) { return cl_combine_impl(tag, (cl_sint)value); } -#ifdef HAVE_LONGLONG inline cl_uint cl_combine (cl_uint tag, unsigned long long value) { return cl_combine_impl(tag, (cl_uint)value); } inline cl_uint cl_combine (cl_uint tag, long long value) { return cl_combine_impl(tag, (cl_uint)value); } -#endif // Definition of the tags. #if !defined(CL_WIDE_POINTERS) diff --git a/include/cln/rational.h b/include/cln/rational.h index 08e558a..aa9f141 100644 --- a/include/cln/rational.h +++ b/include/cln/rational.h @@ -34,12 +34,10 @@ inline const cl_RA operator+ (const long x, const cl_RA& y) { return cl_I(x) + y; } inline const cl_RA operator+ (const unsigned long x, const cl_RA& y) { return cl_I(x) + y; } -#ifdef HAVE_LONGLONG inline const cl_RA operator+ (const long long x, const cl_RA& y) { return cl_I(x) + y; } inline const cl_RA operator+ (const unsigned long long x, const cl_RA& y) { return cl_I(x) + y; } -#endif inline const cl_RA operator+ (const cl_RA& x, const int y) { return x + cl_I(y); } inline const cl_RA operator+ (const cl_RA& x, const unsigned int y) @@ -48,12 +46,10 @@ inline const cl_RA operator+ (const cl_RA& x, const long y) { return x + cl_I(y); } inline const cl_RA operator+ (const cl_RA& x, const unsigned long y) { return x + cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_RA operator+ (const cl_RA& x, const long long y) { return x + cl_I(y); } inline const cl_RA operator+ (const cl_RA& x, const unsigned long long y) { return x + cl_I(y); } -#endif // (- r s), wo r und s rationale Zahlen sind. extern const cl_RA operator- (const cl_RA& r, const cl_RA& s); @@ -66,12 +62,10 @@ inline const cl_RA operator- (const long x, const cl_RA& y) { return cl_I(x) - y; } inline const cl_RA operator- (const unsigned long x, const cl_RA& y) { return cl_I(x) - y; } -#ifdef HAVE_LONGLONG inline const cl_RA operator- (const long long x, const cl_RA& y) { return cl_I(x) - y; } inline const cl_RA operator- (const unsigned long long x, const cl_RA& y) { return cl_I(x) - y; } -#endif inline const cl_RA operator- (const cl_RA& x, const int y) { return x - cl_I(y); } inline const cl_RA operator- (const cl_RA& x, const unsigned int y) @@ -80,12 +74,10 @@ inline const cl_RA operator- (const cl_RA& x, const long y) { return x - cl_I(y); } inline const cl_RA operator- (const cl_RA& x, const unsigned long y) { return x - cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_RA operator- (const cl_RA& x, const long long y) { return x - cl_I(y); } inline const cl_RA operator- (const cl_RA& x, const unsigned long long y) { return x - cl_I(y); } -#endif // (1+ r), wo r eine rationale Zahl ist. extern const cl_RA plus1 (const cl_RA& r); @@ -141,12 +133,10 @@ inline const cl_RA operator* (const long x, const cl_RA& y) { return cl_I(x) * y; } inline const cl_RA operator* (const unsigned long x, const cl_RA& y) { return cl_I(x) * y; } -#ifdef HAVE_LONGLONG inline const cl_RA operator* (const long long x, const cl_RA& y) { return cl_I(x) * y; } inline const cl_RA operator* (const unsigned long long x, const cl_RA& y) { return cl_I(x) * y; } -#endif inline const cl_RA operator* (const cl_RA& x, const int y) { return x * cl_I(y); } inline const cl_RA operator* (const cl_RA& x, const unsigned int y) @@ -155,12 +145,10 @@ inline const cl_RA operator* (const cl_RA& x, const long y) { return x * cl_I(y); } inline const cl_RA operator* (const cl_RA& x, const unsigned long y) { return x * cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_RA operator* (const cl_RA& x, const long long y) { return x * cl_I(y); } inline const cl_RA operator* (const cl_RA& x, const unsigned long long y) { return x * cl_I(y); } -#endif // Quadrat (* r r), wo r eine rationale Zahl ist. extern const cl_RA square (const cl_RA& r); @@ -176,12 +164,10 @@ inline const cl_RA operator/ (const long x, const cl_RA& y) { return cl_I(x) / y; } inline const cl_RA operator/ (const unsigned long x, const cl_RA& y) { return cl_I(x) / y; } -#ifdef HAVE_LONGLONG inline const cl_RA operator/ (const long long x, const cl_RA& y) { return cl_I(x) / y; } inline const cl_RA operator/ (const unsigned long long x, const cl_RA& y) { return cl_I(x) / y; } -#endif inline const cl_RA operator/ (const cl_RA& x, const int y) { return x / cl_I(y); } inline const cl_RA operator/ (const cl_RA& x, const unsigned int y) @@ -190,12 +176,10 @@ inline const cl_RA operator/ (const cl_RA& x, const long y) { return x / cl_I(y); } inline const cl_RA operator/ (const cl_RA& x, const unsigned long y) { return x / cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_RA operator/ (const cl_RA& x, const long long y) { return x / cl_I(y); } inline const cl_RA operator/ (const cl_RA& x, const unsigned long long y) { return x / cl_I(y); } -#endif // Return type for rounding operators. // x / y --> (q,r) with x = y*q+r. @@ -321,10 +305,8 @@ inline cl_RA& operator+= (cl_RA& x, const int y) { return x = x + y; } inline cl_RA& operator+= (cl_RA& x, const unsigned int y) { return x = x + y; } inline cl_RA& operator+= (cl_RA& x, const long y) { return x = x + y; } inline cl_RA& operator+= (cl_RA& x, const unsigned long y) { return x = x + y; } -#ifdef HAVE_LONGLONG inline cl_RA& operator+= (cl_RA& x, const long long y) { return x = x + y; } inline cl_RA& operator+= (cl_RA& x, const unsigned long long y) { return x = x + y; } -#endif inline cl_RA& operator++ /* prefix */ (cl_RA& x) { return x = plus1(x); } inline void operator++ /* postfix */ (cl_RA& x, int dummy) { (void)dummy; x = plus1(x); } inline cl_RA& operator-= (cl_RA& x, const cl_RA& y) { return x = x - y; } @@ -332,10 +314,8 @@ inline cl_RA& operator-= (cl_RA& x, const int y) { return x = x - y; } inline cl_RA& operator-= (cl_RA& x, const unsigned int y) { return x = x - y; } inline cl_RA& operator-= (cl_RA& x, const long y) { return x = x - y; } inline cl_RA& operator-= (cl_RA& x, const unsigned long y) { return x = x - y; } -#ifdef HAVE_LONGLONG inline cl_RA& operator-= (cl_RA& x, const long long y) { return x = x - y; } inline cl_RA& operator-= (cl_RA& x, const unsigned long long y) { return x = x - y; } -#endif 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; } diff --git a/include/cln/rational_class.h b/include/cln/rational_class.h index 633f7cf..318e731 100644 --- a/include/cln/rational_class.h +++ b/include/cln/rational_class.h @@ -22,18 +22,14 @@ public: cl_RA (const unsigned int); // argument must be < 2^29 cl_RA (const long); cl_RA (const unsigned long); -#ifdef HAVE_LONGLONG cl_RA (const long long); cl_RA (const unsigned long long); -#endif cl_RA& operator= (const int); // |argument| must be < 2^29 cl_RA& operator= (const unsigned int); // argument must be < 2^29 cl_RA& operator= (const long); cl_RA& operator= (const unsigned long); -#ifdef HAVE_LONGLONG cl_RA& operator= (const long long); cl_RA& operator= (const unsigned long long); -#endif // Other constructors. cl_RA (const char *); // Private constructor. @@ -61,10 +57,8 @@ CL_DEFINE_INT_CONSTRUCTORS(cl_RA) CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_RA) CL_DEFINE_LONG_CONSTRUCTORS(cl_RA) CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_RA) -#ifdef HAVE_LONGLONG CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_RA) CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_RA) -#endif } // namespace cln diff --git a/include/cln/real.h b/include/cln/real.h index cfcc631..b4ef44e 100644 --- a/include/cln/real.h +++ b/include/cln/real.h @@ -84,12 +84,10 @@ inline const cl_R operator+ (const long x, const cl_R& y) { return cl_I(x) + y; } inline const cl_R operator+ (const unsigned long x, const cl_R& y) { return cl_I(x) + y; } -#ifdef HAVE_LONGLONG inline const cl_R operator+ (const long long x, const cl_R& y) { return cl_I(x) + y; } inline const cl_R operator+ (const unsigned long long x, const cl_R& y) { return cl_I(x) + y; } -#endif inline const cl_F operator+ (const float x, const cl_R& y) { return The(cl_F)(cl_R(x) + y); } inline const cl_F operator+ (const double x, const cl_R& y) @@ -102,12 +100,10 @@ inline const cl_R operator+ (const cl_R& x, const long y) { return x + cl_I(y); } inline const cl_R operator+ (const cl_R& x, const unsigned long y) { return x + cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_R operator+ (const cl_R& x, const long long y) { return x + cl_I(y); } inline const cl_R operator+ (const cl_R& x, const unsigned long long y) { return x + cl_I(y); } -#endif inline const cl_F operator+ (const cl_R& x, const float y) { return The(cl_F)(x + cl_R(y)); } inline const cl_F operator+ (const cl_R& x, const double y) @@ -129,12 +125,10 @@ inline const cl_R operator- (const long x, const cl_R& y) { return cl_I(x) - y; } inline const cl_R operator- (const unsigned long x, const cl_R& y) { return cl_I(x) - y; } -#ifdef HAVE_LONGLONG inline const cl_R operator- (const long long x, const cl_R& y) { return cl_I(x) - y; } inline const cl_R operator- (const unsigned long long x, const cl_R& y) { return cl_I(x) - y; } -#endif inline const cl_F operator- (const float x, const cl_R& y) { return The(cl_F)(cl_R(x) - y); } inline const cl_F operator- (const double x, const cl_R& y) @@ -147,12 +141,10 @@ inline const cl_R operator- (const cl_R& x, const long y) { return x - cl_I(y); } inline const cl_R operator- (const cl_R& x, const unsigned long y) { return x - cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_R operator- (const cl_R& x, const long long y) { return x - cl_I(y); } inline const cl_R operator- (const cl_R& x, const unsigned long long y) { return x - cl_I(y); } -#endif inline const cl_F operator- (const cl_R& x, const float y) { return The(cl_F)(x - cl_R(y)); } inline const cl_F operator- (const cl_R& x, const double y) @@ -169,12 +161,10 @@ inline const cl_R operator* (const long x, const cl_R& y) { return cl_I(x) * y; } inline const cl_R operator* (const unsigned long x, const cl_R& y) { return cl_I(x) * y; } -#ifdef HAVE_LONGLONG inline const cl_R operator* (const long long x, const cl_R& y) { return cl_I(x) * y; } inline const cl_R operator* (const unsigned long long x, const cl_R& y) { return cl_I(x) * y; } -#endif inline const cl_R operator* (const float x, const cl_R& y) { return cl_R(x) * y; } inline const cl_R operator* (const double x, const cl_R& y) @@ -187,12 +177,10 @@ inline const cl_R operator* (const cl_R& x, const long y) { return x * cl_I(y); } inline const cl_R operator* (const cl_R& x, const unsigned long y) { return x * cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_R operator* (const cl_R& x, const long long y) { return x * cl_I(y); } inline const cl_R operator* (const cl_R& x, const unsigned long long y) { return x * cl_I(y); } -#endif inline const cl_R operator* (const cl_R& x, const float y) { return x * cl_R(y); } inline const cl_R operator* (const cl_R& x, const double y) @@ -215,12 +203,10 @@ inline const cl_R operator/ (const long x, const cl_R& y) { return cl_I(x) / y; } inline const cl_R operator/ (const unsigned long x, const cl_R& y) { return cl_I(x) / y; } -#ifdef HAVE_LONGLONG inline const cl_R operator/ (const long long x, const cl_R& y) { return cl_I(x) / y; } inline const cl_R operator/ (const unsigned long long x, const cl_R& y) { return cl_I(x) / y; } -#endif inline const cl_F operator/ (const float x, const cl_R& y) { return The(cl_F)(cl_R(x) / y); } inline const cl_F operator/ (const double x, const cl_R& y) @@ -233,12 +219,10 @@ inline const cl_R operator/ (const cl_R& x, const long y) { return x / cl_I(y); } inline const cl_R operator/ (const cl_R& x, const unsigned long y) { return x / cl_I(y); } -#ifdef HAVE_LONGLONG inline const cl_R operator/ (const cl_R& x, const long long y) { return x / cl_I(y); } inline const cl_R operator/ (const cl_R& x, const unsigned long long y) { return x / cl_I(y); } -#endif inline const cl_R operator/ (const cl_R& x, const float y) { return x / cl_R(y); } inline const cl_R operator/ (const cl_R& x, const double y) @@ -534,20 +518,16 @@ inline cl_R& operator+= (cl_R& x, const int y) { return x = x + y; } inline cl_R& operator+= (cl_R& x, const unsigned int y) { return x = x + y; } inline cl_R& operator+= (cl_R& x, const long y) { return x = x + y; } inline cl_R& operator+= (cl_R& x, const unsigned long y) { return x = x + y; } -#ifdef HAVE_LONGLONG inline cl_R& operator+= (cl_R& x, const long long y) { return x = x + y; } inline cl_R& operator+= (cl_R& x, const unsigned long long y) { return x = x + y; } -#endif inline cl_F& operator+= (cl_R& x, const float y) { return static_cast(x = x + y); } inline cl_F& operator+= (cl_R& x, const double y) { return static_cast(x = x + y); } inline cl_F& operator+= (cl_F& x, const int y) { return x = x + y; } inline cl_F& operator+= (cl_F& x, const unsigned int y) { return x = x + y; } inline cl_F& operator+= (cl_F& x, const long y) { return x = x + y; } inline cl_F& operator+= (cl_F& x, const unsigned long y) { return x = x + y; } -#ifdef HAVE_LONGLONG 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 inline cl_R& operator++ /* prefix */ (cl_R& x) { return x = plus1(x); } inline void operator++ /* postfix */ (cl_R& x, int dummy) { (void)dummy; x = plus1(x); } inline cl_R& operator-= (cl_R& x, const cl_R& y) { return x = x - y; } @@ -558,20 +538,16 @@ inline cl_R& operator-= (cl_R& x, const int y) { return x = x - y; } inline cl_R& operator-= (cl_R& x, const unsigned int y) { return x = x - y; } inline cl_R& operator-= (cl_R& x, const long y) { return x = x - y; } inline cl_R& operator-= (cl_R& x, const unsigned long y) { return x = x - y; } -#ifdef HAVE_LONGLONG inline cl_R& operator-= (cl_R& x, const long long y) { return x = x - y; } inline cl_R& operator-= (cl_R& x, const unsigned long long y) { return x = x - y; } -#endif inline cl_F& operator-= (cl_R& x, const float y) { return static_cast(x = x - y); } inline cl_F& operator-= (cl_R& x, const double y) { return static_cast(x = x - y); } inline cl_F& operator-= (cl_F& x, const int y) { return x = x - y; } inline cl_F& operator-= (cl_F& x, const unsigned int y) { return x = x - y; } inline cl_F& operator-= (cl_F& x, const long y) { return x = x - y; } inline cl_F& operator-= (cl_F& x, const unsigned long y) { return x = x - y; } -#ifdef HAVE_LONGLONG 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 inline cl_R& operator-- /* prefix */ (cl_R& x) { return x = minus1(x); } inline void operator-- /* postfix */ (cl_R& x, int dummy) { (void)dummy; x = minus1(x); } inline cl_R& operator*= (cl_R& x, const cl_R& y) { return x = x * y; } @@ -579,10 +555,8 @@ inline cl_R& operator*= (cl_R& x, const int y) { return x = x * y; } inline cl_R& operator*= (cl_R& x, const unsigned int y) { return x = x * y; } inline cl_R& operator*= (cl_R& x, const long y) { return x = x * y; } inline cl_R& operator*= (cl_R& x, const unsigned long y) { return x = x * y; } -#ifdef HAVE_LONGLONG inline cl_R& operator*= (cl_R& x, const long long y) { return x = x * y; } inline cl_R& operator*= (cl_R& x, const unsigned long long y) { return x = x * y; } -#endif inline cl_R& operator*= (cl_R& x, const float y) { return x = x * y; } inline cl_R& operator*= (cl_R& x, const double y) { return x = x * y; } inline cl_R& operator/= (cl_R& x, const cl_R& y) { return x = x / y; } @@ -593,20 +567,16 @@ inline cl_R& operator/= (cl_R& x, const int y) { return x = x / y; } inline cl_R& operator/= (cl_R& x, const unsigned int y) { return x = x / y; } inline cl_R& operator/= (cl_R& x, const long y) { return x = x / y; } inline cl_R& operator/= (cl_R& x, const unsigned long y) { return x = x / y; } -#ifdef HAVE_LONGLONG inline cl_R& operator/= (cl_R& x, const long long y) { return x = x / y; } inline cl_R& operator/= (cl_R& x, const unsigned long long y) { return x = x / y; } -#endif inline cl_R& operator/= (cl_R& x, const float y) { return x = x / y; } inline cl_R& operator/= (cl_R& x, const double y) { return x = x / y; } inline cl_F& operator/= (cl_F& x, const int y) { return x = x / y; } inline cl_F& operator/= (cl_F& x, const unsigned int y) { return x = x / y; } inline cl_F& operator/= (cl_F& x, const long y) { return x = x / y; } inline cl_F& operator/= (cl_F& x, const unsigned long y) { return x = x / y; } -#ifdef HAVE_LONGLONG 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 // Complex operations, trivial for reals diff --git a/include/cln/real_class.h b/include/cln/real_class.h index 44f25e3..5129e5d 100644 --- a/include/cln/real_class.h +++ b/include/cln/real_class.h @@ -22,10 +22,8 @@ public: cl_R (const unsigned int); // argument must be < 2^29 cl_R (const long); cl_R (const unsigned long); -#ifdef HAVE_LONGLONG cl_R (const long long); cl_R (const unsigned long long); -#endif cl_R (const float); cl_R (const double); cl_R& operator= (const int); // |argument| must be < 2^29 @@ -34,10 +32,8 @@ public: cl_R& operator= (const unsigned long); cl_R& operator= (const float); cl_R& operator= (const double); -#ifdef HAVE_LONGLONG cl_R& operator= (const long long); cl_R& operator= (const unsigned long long); -#endif // Other constructors. cl_R (const char *); // Private constructor. @@ -64,10 +60,8 @@ CL_DEFINE_INT_CONSTRUCTORS(cl_R) CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_R) CL_DEFINE_LONG_CONSTRUCTORS(cl_R) CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_R) -#ifdef HAVE_LONGLONG CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_R) CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_R) -#endif CL_DEFINE_FLOAT_CONSTRUCTOR(cl_R) CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_R) diff --git a/include/cln/types.h b/include/cln/types.h index 7ec3770..25284ff 100644 --- a/include/cln/types.h +++ b/include/cln/types.h @@ -41,17 +41,13 @@ #if (long_bitsize==64) typedef long sint64; typedef unsigned long uint64; - #undef HAVE_LONGLONG - #define HAVE_LONGLONG - #elif defined(HAVE_LONGLONG) - #if defined(long_long_bitsize) && (long_long_bitsize==64) + #elif (long_long_bitsize==64) typedef long long sint64; typedef unsigned long long uint64; - #else // unusable type - #undef HAVE_LONGLONG - #endif + #else + #error "No 64 bit integer type?" #endif - #if defined(HAVE_LONGLONG) && (defined(__alpha__) || defined(__ia64__) || defined(__mips64__) || defined(__powerpc64__) || defined(__s390x__) || (defined(__sparc__) && defined(__arch64__)) || (defined(__x86_64__) || defined(_M_AMD64)) || defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64)) || defined(__e2k__) + #if (defined(__alpha__) || defined(__ia64__) || defined(__mips64__) || defined(__powerpc64__) || defined(__s390x__) || (defined(__sparc__) && defined(__arch64__)) || (defined(__x86_64__) || defined(_M_AMD64)) || defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64) || defined(__e2k__)) // 64 bit registers in hardware #define HAVE_FAST_LONGLONG #endif @@ -65,11 +61,9 @@ #define intLsize 32 typedef sint32 sintL; typedef uint32 uintL; - #ifdef HAVE_LONGLONG - #define intQsize 64 - typedef sint64 sintQ; - typedef uint64 uintQ; - #endif + #define intQsize 64 + typedef sint64 sintQ; + typedef uint64 uintQ; // Type for three values (0, +1, -1). typedef int cl_signean; @@ -91,7 +85,7 @@ // Integer type used for lfloat exponents. // Constraint: sizeof(uintE) >= sizeof(uintC) - #if (defined(HAVE_LONGLONG) && (defined(__alpha__) || defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__) || (defined(__sparc__) && defined(__arch64__)) || defined(__x86_64__) || defined(__i386__) || defined(__mips__) || defined(__rs6000__) || defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64) || defined(__e2k__))) + #if (defined(__alpha__) || defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__) || (defined(__sparc__) && defined(__arch64__)) || defined(__x86_64__) || defined(__i386__) || defined(__mips__) || defined(__rs6000__) || defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64) || defined(__e2k__)) #define intEsize 64 typedef sint64 sintE; typedef uint64 uintE; diff --git a/m4/floatparam.m4 b/m4/floatparam.m4 index 6afda75..1a84e56 100644 --- a/m4/floatparam.m4 +++ b/m4/floatparam.m4 @@ -1,14 +1,13 @@ -# floatparam.m4 serial 1 -dnl Copyright (C) 2005 Free Software Foundation, Inc. +# floatparam.m4 serial 3 -*- Autoconf -*- +dnl Copyright (C) 2005-2008, 2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -dnl From Bruno Haible. +dnl From Bruno Haible, Sam Steingold. AC_DEFUN([CL_FLOATPARAM_CROSS], [ - AC_REQUIRE([CL_LONGDOUBLE]) cl_machine_file_h=$1 { echo "/* Rounding modes, for use below */" @@ -17,21 +16,29 @@ AC_DEFUN([CL_FLOATPARAM_CROSS], echo "#define rounds_to_infinity 2 /* 1 ulp */" echo "#define rounds_to_minus_infinity 3 /* 1 ulp */" echo - for type in float double "`if test $cl_cv_c_longdouble = yes; then echo 'long double'; fi`"; do + for type in float double "long double"; do if test -n "$type"; then epsilon_bits=-1; y="($type)1.0" while true; do - AC_TRY_COMPILE([], - [static_assert((($type)(($type)1.0 + ($type)($y)) == ($type)1.0) - || ($type)(($type)(($type)1.0 + ($type)($y)) - ($type)1.0) != ($type)($y), "");], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], + [[typedef int verify[2*( + (($type)(($type)1.0 + ($type)($y)) == ($type)1.0) + || ($type)(($type)(($type)1.0 + ($type)($y)) - ($type)1.0) != ($type)($y) + ) - 1];]]) + ], [break;]) epsilon_bits=`expr $epsilon_bits + 1`; y="$y * ($type)0.5" done negepsilon_bits=-1; y="($type)-1.0" while true; do - AC_TRY_COMPILE([], - [static_assert((($type)(($type)1.0 + ($type)($y)) == ($type)1.0) - || ($type)(($type)(($type)1.0 + ($type)($y)) - ($type)1.0) != ($type)($y), "");], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], + [[typedef int verify[2*( + (($type)(($type)1.0 + ($type)($y)) == ($type)1.0) + || ($type)(($type)(($type)1.0 + ($type)($y)) - ($type)1.0) != ($type)($y) + ) - 1];]]) + ], [break;]) negepsilon_bits=`expr $negepsilon_bits + 1`; y="$y * ($type)0.5" done @@ -63,23 +70,39 @@ AC_DEFUN([CL_FLOATPARAM_CROSS], zs2="($type)(($type)-1.0 + ($type)(-5.6)*$x)" rounds= if test -z "$rounds"; then - AC_TRY_COMPILE([], - [static_assert($ys1 == $y1 && $ys2 == $y2 && $zs1 == $z1 && $zs2 == $z2, "");], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], + [[typedef int verify[2*( + $ys1 == $y1 && $ys2 == $y2 && $zs1 == $z1 && $zs2 == $z2 + ) - 1];]]) + ], [rounds=rounds_to_nearest]) fi if test -z "$rounds"; then - AC_TRY_COMPILE([], - [static_assert($ys1 == $y1 && $ys2 == $y1 && $zs1 == $z1 && $zs2 == $z1, "");], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], + [[typedef int verify[2*( + $ys1 == $y1 && $ys2 == $y1 && $zs1 == $z1 && $zs2 == $z1 + ) - 1];]]) + ], [rounds=rounds_to_zero]) fi if test -z "$rounds"; then - AC_TRY_COMPILE([], - [static_assert($ys1 == $y2 && $ys2 == $y2 && $zs1 == $z1 && $zs2 == $z1, "");], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], + [[typedef int verify[2*( + $ys1 == $y2 && $ys2 == $y2 && $zs1 == $z1 && $zs2 == $z1 + ) - 1];]]) + ], [rounds=rounds_to_infinity]) fi if test -z "$rounds"; then - AC_TRY_COMPILE([], - [static_assert($ys1 == $y1 && $ys2 == $y1 && $zs1 == $z2 && $zs2 == $z2, "");], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], + [[typedef int verify[2*( + $ys1 == $y1 && $ys2 == $y1 && $zs1 == $z2 && $zs2 == $z2 + ) - 1];]]) + ], [rounds=rounds_to_minus_infinity]) fi if test -n "$rounds"; then @@ -96,17 +119,23 @@ AC_DEFUN([CL_FLOATPARAM_CROSS], dnl 2.5495230282078065 = { 0x40 0x04 0x65 0x6C 0x54 0x54 0x69 0x4C } ..elTTiL dnl 1.4139248369879473e214 = { 0x6C 0x65 0x00 0x00 0x4C 0x69 0x54 0x54 } le..LiTT double_wordorder_bigendian_p= - AC_TRY_COMPILE([double a[9] = { - 0, 2.5479915693083957, 0, 1.4396527506122064e164, - 0, 2.5495230282078065, 0, 1.4139248369879473e214, - 0 };], [], [ - if grep LiTTle conftest.$ac_objext >/dev/null ; then - double_wordorder_bigendian_p=0 - else - if grep bIgeN conftest.$ac_objext >/dev/null ; then - double_wordorder_bigendian_p=1 - fi - fi]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + double a[9] = { + 0, 2.5479915693083957, 0, 1.4396527506122064e164, + 0, 2.5495230282078065, 0, 1.4139248369879473e214, + 0 }; + ]], + []) + ], + [if grep LiTTle conftest.$ac_objext >/dev/null; then + double_wordorder_bigendian_p=0 + else + if grep bIgeN conftest.$ac_objext >/dev/null; then + double_wordorder_bigendian_p=1 + fi + fi + ]) if test -n "$double_wordorder_bigendian_p"; then echo "#define double_wordorder_bigendian_p $double_wordorder_bigendian_p" else diff --git a/m4/intparam.m4 b/m4/intparam.m4 index 3c990d7..2619013 100644 --- a/m4/intparam.m4 +++ b/m4/intparam.m4 @@ -1,15 +1,13 @@ -# intparam.m4 serial 1 -dnl Copyright (C) 2005 Free Software Foundation, Inc. +# intparam.m4 serial 4 -*- Autoconf -*- +dnl Copyright (C) 1993-2008, 2017, 2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -dnl From Bruno Haible. +dnl From Bruno Haible, Sam Steingold AC_DEFUN([CL_INTPARAM_CROSS], [ - AC_REQUIRE([CL_LONGLONG]) - AC_REQUIRE([CL_LONGDOUBLE]) AC_REQUIRE([AC_C_BIGENDIAN]) cl_machine_file_h=$1 { @@ -17,16 +15,12 @@ AC_DEFUN([CL_INTPARAM_CROSS], CL_INTPARAM_BITSIZE([short], [short_bitsize]) CL_INTPARAM_BITSIZE([int], [int_bitsize]) CL_INTPARAM_BITSIZE([long], [long_bitsize]) - if test $cl_cv_c_longlong = yes; then - CL_INTPARAM_BITSIZE([long long], [longlong_bitsize]) - fi + CL_INTPARAM_BITSIZE([long long], [longlong_bitsize]) CL_INTPARAM_BITSIZE([unsigned char], [uchar_bitsize]) CL_INTPARAM_BITSIZE([unsigned short], [ushort_bitsize]) CL_INTPARAM_BITSIZE([unsigned int], [uint_bitsize]) CL_INTPARAM_BITSIZE([unsigned long], [ulong_bitsize]) - if test $cl_cv_c_longlong = yes; then - CL_INTPARAM_BITSIZE([unsigned long long], [ulonglong_bitsize]) - fi + CL_INTPARAM_BITSIZE([unsigned long long], [ulonglong_bitsize]) if test -n "$char_bitsize"; then echo "/* Integers of type char have $char_bitsize bits. */" echo "#define char_bitsize $char_bitsize" @@ -55,14 +49,12 @@ AC_DEFUN([CL_INTPARAM_CROSS], else echo "#error \"Integers of type long have no binary representation!!\"" fi - if test $cl_cv_c_longlong = yes; then - if test -n "$longlong_bitsize"; then - echo "/* Integers of type long long have $longlong_bitsize bits. */" - echo "#define long_long_bitsize $longlong_bitsize" - echo - else - echo "#error \"Integers of type long long have no binary representation!!\"" - fi + if test -n "$longlong_bitsize"; then + echo "/* Integers of type long long have $longlong_bitsize bits. */" + echo "#define long_long_bitsize $longlong_bitsize" + echo + else + echo "#error \"Integers of type long long have no binary representation!!\"" fi if test -n "$uchar_bitsize"; then echo "/* Integers of type unsigned char have $uchar_bitsize bits. */" @@ -88,13 +80,11 @@ AC_DEFUN([CL_INTPARAM_CROSS], else echo "#error \"Integers of type unsigned long have no binary representation!!\"" fi - if test $cl_cv_c_longlong = yes; then - if test -n "$ulonglong_bitsize"; then - echo "/* Integers of type unsigned long long have $ulonglong_bitsize bits. */" - echo - else - echo "#error \"Integers of type unsigned long long have no binary representation!!\"" - fi + if test -n "$ulonglong_bitsize"; then + echo "/* Integers of type unsigned long long have $ulonglong_bitsize bits. */" + echo + else + echo "#error \"Integers of type unsigned long long have no binary representation!!\"" fi if test "$char_bitsize" != "$uchar_bitsize"; then echo "#error \"Integer types char and unsigned char have different sizes!!\"" @@ -108,12 +98,11 @@ AC_DEFUN([CL_INTPARAM_CROSS], if test "$long_bitsize" != "$ulong_bitsize"; then echo "#error \"Integer types long and unsigned long have different sizes!!\"" fi - if test $cl_cv_c_longlong = yes; then - if test "$longlong_bitsize" != "$ulonglong_bitsize"; then - echo "#error \"Integer types long long and unsigned long long have different sizes!!\"" - fi + if test "$longlong_bitsize" != "$ulonglong_bitsize"; then + echo "#error \"Integer types long long and unsigned long long have different sizes!!\"" fi - AC_TRY_COMPILE([#include ], [static_assert(sizeof(char*) <= sizeof(intptr_t), "");], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[typedef int verify[2*(sizeof(char*)<=sizeof (intptr_t))-1];]])], [], [echo "#error \"Type char * does not fit into an intptr_t!!\""]) _AC_COMPUTE_INT([sizeof (char *)], [pointer_size]) pointer_bitsize=`expr $pointer_size '*' $char_bitsize` @@ -160,18 +149,16 @@ AC_DEFUN([CL_INTPARAM_CROSS], CL_INTPARAM_ALIGNOF([unsigned long], [alignment_ulong]) echo "/* Type unsigned long has sizeof = $sizeof_ulong and alignment = $alignment_ulong. */" echo - if test $cl_cv_c_longlong = yes; then - CL_INTPARAM_SIZEOF([long long], [sizeof_longlong]) - CL_INTPARAM_ALIGNOF([long long], [alignment_longlong]) - echo "/* Type long long has sizeof = $sizeof_longlong and alignment = $alignment_longlong. */" - echo "#define sizeof_long_long $sizeof_longlong" - echo "#define alignment_long_long $alignment_longlong" - echo - CL_INTPARAM_SIZEOF([unsigned long long], [sizeof_ulonglong]) - CL_INTPARAM_ALIGNOF([unsigned long long], [alignment_ulonglong]) - echo "/* Type unsigned long long has sizeof = $sizeof_ulonglong and alignment = $alignment_ulonglong. */" - echo - fi + CL_INTPARAM_SIZEOF([long long], [sizeof_longlong]) + CL_INTPARAM_ALIGNOF([long long], [alignment_longlong]) + echo "/* Type long long has sizeof = $sizeof_longlong and alignment = $alignment_longlong. */" + echo "#define sizeof_long_long $sizeof_longlong" + echo "#define alignment_long_long $alignment_longlong" + echo + CL_INTPARAM_SIZEOF([unsigned long long], [sizeof_ulonglong]) + CL_INTPARAM_ALIGNOF([unsigned long long], [alignment_ulonglong]) + echo "/* Type unsigned long long has sizeof = $sizeof_ulonglong and alignment = $alignment_ulonglong. */" + echo CL_INTPARAM_SIZEOF([float], [sizeof_float]) CL_INTPARAM_ALIGNOF([float], [alignment_float]) echo "/* Type float has sizeof = $sizeof_float and alignment = $alignment_float. */" @@ -184,14 +171,12 @@ AC_DEFUN([CL_INTPARAM_CROSS], echo "#define sizeof_double $sizeof_double" echo "#define alignment_double $alignment_double" echo - if test $cl_cv_c_longdouble = yes; then - CL_INTPARAM_SIZEOF([long double], [sizeof_longdouble]) - CL_INTPARAM_ALIGNOF([long double], [alignment_longdouble]) - echo "/* Type long double has sizeof = $sizeof_longdouble and alignment = $alignment_longdouble. */" - echo "#define sizeof_long_double $sizeof_longdouble" - echo "#define alignment_long_double $alignment_longdouble" - echo - fi + CL_INTPARAM_SIZEOF([long double], [sizeof_longdouble]) + CL_INTPARAM_ALIGNOF([long double], [alignment_longdouble]) + echo "/* Type long double has sizeof = $sizeof_longdouble and alignment = $alignment_longdouble. */" + echo "#define sizeof_long_double $sizeof_longdouble" + echo "#define alignment_long_double $alignment_longdouble" + echo CL_INTPARAM_SIZEOF([char *], [sizeof_char_ptr]) CL_INTPARAM_ALIGNOF([char *], [alignment_char_ptr]) echo "/* Type char * has sizeof = $sizeof_char_ptr and alignment = $alignment_char_ptr. */" @@ -200,8 +185,13 @@ AC_DEFUN([CL_INTPARAM_CROSS], CL_INTPARAM_ALIGNOF([long *], [alignment_long_ptr]) echo "/* Type long * has sizeof = $sizeof_long_ptr and alignment = $alignment_long_ptr. */" echo - CL_INTPARAM_SIZEOF([void (*)(void)], [sizeof_function_ptr]) - CL_INTPARAM_ALIGNOF([void (*)(void)], [alignment_function_ptr]) + dnl disabled because: + dnl - the results of these are not used anywhere + dnl - the results of non-cross are not generated (see src/intparam.h) + dnl - the C code fails with "expected identifier or '(' before ')' token" + dnl on the line "typedef int verify[2*(alignof(void (*)(void)) == 256) - 1];" + dnl CL_INTPARAM_SIZEOF([void (*)(void)], [sizeof_function_ptr]) + dnl CL_INTPARAM_ALIGNOF([void (*)(void)], [alignment_function_ptr]) echo "/* Type function * has sizeof = $sizeof_function_ptr and alignment = $alignment_function_ptr. */" echo case $ac_cv_c_bigendian in @@ -212,10 +202,8 @@ AC_DEFUN([CL_INTPARAM_CROSS], echo "#define int_big_endian" echo "/* Type unsigned long is stored BIG-ENDIAN in memory (i.e. like mc68000 or sparc). */" echo "#define long_big_endian" - if test $cl_cv_c_longlong = yes; then - echo "/* Type unsigned long long is stored BIG-ENDIAN in memory (i.e. like mc68000 or sparc). */" - echo "#define long_long_big_endian" - fi + echo "/* Type unsigned long long is stored BIG-ENDIAN in memory (i.e. like mc68000 or sparc). */" + echo "#define long_long_big_endian" ;; no) echo "/* Type unsigned short is stored LITTLE-ENDIAN in memory (i.e. like Z80 or VAX). */" @@ -224,18 +212,14 @@ AC_DEFUN([CL_INTPARAM_CROSS], echo "#define int_little_endian" echo "/* Type unsigned long is stored LITTLE-ENDIAN in memory (i.e. like Z80 or VAX). */" echo "#define long_little_endian" - if test $cl_cv_c_longlong = yes; then - echo "/* Type unsigned long long is stored LITTLE-ENDIAN in memory (i.e. like Z80 or VAX). */" - echo "#define long_long_little_endian" - fi + echo "/* Type unsigned long long is stored LITTLE-ENDIAN in memory (i.e. like Z80 or VAX). */" + echo "#define long_long_little_endian" ;; *) echo "#error \"Type short is stored in memory in an obscure manner!!\"" echo "#error \"Type int is stored in memory in an obscure manner!!\"" echo "#error \"Type long is stored in memory in an obscure manner!!\"" - if test $cl_cv_c_longlong = yes; then - echo "#error \"Type long long is stored in memory in an obscure manner!!\"" - fi + echo "#error \"Type long long is stored in memory in an obscure manner!!\"" ;; esac echo @@ -258,7 +242,8 @@ AC_DEFUN([CL_INTPARAM_BITSIZE], [ n=1; x="($1)2" while true; do - AC_TRY_COMPILE([], [typedef int verify[2*(($1)($x) == 0) - 1];], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], + [[typedef int verify[2*(($1)($x) == 0) - 1];]])], [$2=$n; break;], [if test $n = 1000; then $2=; break; fi;]) n=`expr $n + 1`; x="$x * ($1)2" @@ -274,23 +259,25 @@ AC_DEFUN([CL_INTPARAM_SIZEOF], dnl CL_INTPARAM_ALIGNOF(type, variable) dnl puts into variable the determined alignment of the type. -AC_DEFUN([CL_INTPARAM_ALIGNOF], -[ +AC_DEFUN([CL_INTPARAM_ALIGNOF],[ dnl Simplify the guessing by assuming that the alignment is a power of 2. n=1 while true; do - AC_TRY_COMPILE([ -#ifdef __cplusplus -# ifdef __GNUC__ -# define alignof(type) __alignof__ (type) -# else - template struct alignof_helper { char slot1; type slot2; }; -# define alignof(type) offsetof (alignof_helper, slot2) -# endif -#else -# define alignof(type) offsetof (struct { char slot1; type slot2; }, slot2) -#endif -], [static_assert(alignof($1) == $n, "");], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include + #ifdef __cplusplus + #ifdef __GNUC__ + #define alignof(type) __alignof__ (type) + #else + template struct alignof_helper { char slot1; type slot2; }; + #define alignof(type) offsetof (alignof_helper, slot2) + #endif + #else + #define alignof(type) offsetof (struct { char slot1; type slot2; }, slot2) + #endif + ]], + [[typedef int verify[2*(alignof($1) == $n) - 1];]])], [$2=$n; break;] [if test $n = 0; then $2=; break; fi]) n=`expr $n '*' 2` diff --git a/m4/longdouble.m4 b/m4/longdouble.m4 deleted file mode 100644 index e51c4c5..0000000 --- a/m4/longdouble.m4 +++ /dev/null @@ -1,31 +0,0 @@ -dnl Copyright (C) 1993-2006 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible, Marcus Daniels, Paul Eggert. - -AC_PREREQ(2.13) - -AC_DEFUN([CL_LONGDOUBLE], -[AC_CACHE_CHECK(for long double type, cl_cv_c_longdouble, [ -AC_TRY_RUN([ -#include -int main() -{ long double x = 2.7182818284590452354L; x = x*x; exit (x==0.0L); } -], -cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no, [ -dnl When cross-compiling, use the test from gnulib. -AC_TRY_COMPILE([ - /* The Stardent Vistra knows sizeof(long double), but does not support it. */ - long double foo = 0.0; - /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ - int array [2*(sizeof(long double) >= sizeof(double)) - 1]; - ], , cl_cv_c_longdouble=yes, cl_cv_c_longdouble=no)]) -]) -if test $cl_cv_c_longdouble = yes; then - AC_DEFINE(HAVE_LONGDOUBLE, ,[Define if compiler supports long double type]) -fi -]) diff --git a/m4/longlong.m4 b/m4/longlong.m4 deleted file mode 100644 index 78fae88..0000000 --- a/m4/longlong.m4 +++ /dev/null @@ -1,42 +0,0 @@ -dnl -*- Autoconf -*- -dnl Copyright (C) 1993-2006 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible, Marcus Daniels, Sam Steingold, Paul Eggert. - -AC_PREREQ(2.57) - -AC_DEFUN([CL_LONGLONG], -[AC_CACHE_CHECK(for long long type, cl_cv_c_longlong, [ -AC_TRY_RUN([ -#include -int main() -{ -/* long longs don't work right with gcc-2.7.2 on m68k */ -/* long longs don't work right with gcc-2.7.2 on rs6000: avcall/tests.c gets - miscompiled. */ -#if defined(__m68k__) || (defined(_IBMR2) || defined(__powerpc)) -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7) - exit(1); -#endif -#endif - { long x = 944938507; long y = 737962842; long z = 162359677; - exit(!(((long long) x)*((long long) y)>>32 == z)); - } -}], -cl_cv_c_longlong=yes, cl_cv_c_longlong=no, [ -dnl When cross-compiling, use the test from gnulib. -AC_TRY_LINK([long long ll = 1LL; int i = 63;], - [long long llmax = (long long) -1; - return ll << i | ll >> i | llmax / ll | llmax % ll;], - cl_cv_c_longlong=yes, - cl_cv_c_longlong=no)]) -]) -if test $cl_cv_c_longlong = yes; then - AC_DEFINE(HAVE_LONGLONG,,[compiler supports the `long long' type]) -fi -]) diff --git a/m4/param.m4 b/m4/param.m4 index 21a7b84..bb21d36 100644 --- a/m4/param.m4 +++ b/m4/param.m4 @@ -1,5 +1,5 @@ dnl -*- Autoconf -*- -dnl Copyright (C) 1993-2005 Free Software Foundation, Inc. +dnl Copyright (C) 1993-2008, 2011, 2017 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program @@ -8,47 +8,37 @@ dnl the same distribution terms as the rest of that program. dnl From Bruno Haible, Marcus Daniels, Sam Steingold. -AC_PREREQ(2.13) +AC_PREREQ([2.61]) dnl CL_MACHINE([MESSAGE], [PROGRAM_TO_RUN], [CROSS_MACRO], [DESTINATION], [CACHE_VAR]) AC_DEFUN([CL_MACHINE], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_C_CHAR_UNSIGNED])dnl -cl_machine_file_c=$2 -if test -z "$[$5]"; then -AC_CHECKING(for [$1]) -if test $cross_compiling = no; then -cl_machine_file_h=$4 -cat > conftest.$ac_ext <> conftest.$ac_ext -ORIGCC="$CC" -if test $ac_cv_prog_gcc = yes; then -# gcc -O (gcc version <= 2.3.2) crashes when compiling long long shifts for -# target 80386. Strip "-O". -CC=`echo "$CC " | sed -e 's/-O //g'` -fi -AC_TRY_EVAL(ac_link) -CC="$ORIGCC" -if test -s conftest${ac_exeext}; then - echo "creating $cl_machine_file_h" - ./conftest${ac_exeext} > conftest.h - if cmp -s "$cl_machine_file_h" conftest.h 2>/dev/null; then - # The file exists and we would not be changing it +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_C_CHAR_UNSIGNED]) + cl_machine_file_c=$2 + if test -z "$[$5]"; then + AC_MSG_CHECKING(for [$1]) + cl_machine_file_h=$4 + cl_machine_file_program=`cat "$cl_machine_file_c"` + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + #include "confdefs.h" + $cl_machine_file_program + ])], + [AC_MSG_RESULT([created $cl_machine_file_h]) + if cmp -s "$cl_machine_file_h" conftest.h 2>/dev/null; then + # The file exists and we would not be changing it + rm -f conftest.h + else + rm -f "$cl_machine_file_h" + mv conftest.h "$cl_machine_file_h" + fi + [$5]=1 + ], + [AC_MSG_RESULT([creation of $cl_machine_file_h failed])], + [AC_MSG_RESULT([creating $cl_machine_file_h]) + $3([$4]) + ]) rm -f conftest.h - else - rm -f "$cl_machine_file_h" - mv conftest.h "$cl_machine_file_h" fi - [$5]=1 -else - echo "creation of $cl_machine_file_h failed" -fi -rm -f conftest* -else -echo "creating $cl_machine_file_h" -$3([$4]) -fi -fi ]) diff --git a/src/base/cl_low.h b/src/base/cl_low.h index d2b9cd1..ee47bf1 100644 --- a/src/base/cl_low.h +++ b/src/base/cl_low.h @@ -77,8 +77,6 @@ inline uint32 highlow32_0 (uint16 high) return (uint32)high << 16; } -#ifdef HAVE_LONGLONG - // High-Word einer 64-Bit-Zahl bestimmen // high32(wert) inline uint32 high32 (uint64 wert) @@ -107,8 +105,6 @@ inline uint64 highlow64_0 (uint32 high) return (uint64)high << 32; } -#endif /* HAVE_LONGLONG */ - // Multipliziert zwei 16-Bit-Zahlen miteinander und liefert eine 32-Bit-Zahl: // mulu16(arg1,arg2) @@ -287,7 +283,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) ); \ unused (hi_zuweisung _hi); lo_zuweisung _lo; \ }) -#elif defined(__GNUC__) && defined(HAVE_LONGLONG) && !defined(__arm__) +#elif defined(__GNUC__) && !defined(__arm__) #define mulu32(x,y,hi_zuweisung,lo_zuweisung) \ ({ var register uint64 _prod = (uint64)(uint32)(x) * (uint64)(uint32)(y); \ unused (hi_zuweisung (uint32)(_prod>>32)); \ @@ -759,7 +755,7 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) }) #define divu_6432_3232_(xhi,xlo,y) \ ({var uint32 ___q; divu_6432_3232(xhi,xlo,y,___q=,); ___q; }) -#elif defined(__GNUC__) && defined(HAVE_LONGLONG) && !defined(__arm__) +#elif defined(__GNUC__) && !defined(__arm__) #define divu_6432_3232(xhi,xlo,y,q_zuweisung,r_zuweisung) \ ({var uint32 __xhi = (xhi); \ var uint32 __xlo = (xlo); \ @@ -1254,13 +1250,11 @@ inline uint32 mulu32_unchecked (uint32 arg1, uint32 arg2) // < uintL ergebnis : Wurzel, >=0, <2^16 extern uintL isqrt (uintL x); -#ifdef HAVE_LONGLONG // Extracts integer root of a 64-bit number and returns a 32-bit number. // isqrt(x) // > uintQ x : radicand, >=0, <2^64 // < uintL result : square root, >=0, <2^32 extern uintL isqrt (uintQ x); -#endif // Sorry for this. We need an isqrt function taking uintC arguments but we // cannot use overloading since this would lead to ambiguities with any of the diff --git a/src/base/digit/cl_D.h b/src/base/digit/cl_D.h index 5aa861f..4d91717 100644 --- a/src/base/digit/cl_D.h +++ b/src/base/digit/cl_D.h @@ -82,7 +82,7 @@ inline sint32 sign_of_sintD (sintD wert) #if (intDsize==16) #define muluD mulu16 #endif - #if (intDsize==32) && defined(HAVE_LONGLONG) + #if (intDsize==32) #define muluD(arg1,arg2) ((uintDD)(uintD)(arg1)*(uintDD)(uintD)(arg2)) #endif #else @@ -117,7 +117,7 @@ inline sint32 sign_of_sintD (sintD wert) #if (intDsize==16) #define divuD divu_3216_1616 #endif - #if (intDsize==32) && defined(HAVE_LONGLONG) + #if (intDsize==32) #define divuD(x,y,q_zuweisung,r_zuweisung) \ { var uint64 __x = (x); \ var uint32 __y = (y); \ diff --git a/src/base/digitseq/cl_DS_mul_fftc.h b/src/base/digitseq/cl_DS_mul_fftc.h index 6bd2123..371f1a8 100644 --- a/src/base/digitseq/cl_DS_mul_fftc.h +++ b/src/base/digitseq/cl_DS_mul_fftc.h @@ -159,7 +159,7 @@ #include "cln/floatparam.h" #include "cln/exception.h" -#if defined(HAVE_LONGDOUBLE) && (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) +#if (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) // Only these CPUs have fast "long double"s in hardware. // On SPARC, "long double"s are emulated in software and don't work. typedef long double fftc_real; diff --git a/src/base/digitseq/cl_DS_mul_fftcs.h b/src/base/digitseq/cl_DS_mul_fftcs.h index 6269bf2..75b20de 100644 --- a/src/base/digitseq/cl_DS_mul_fftcs.h +++ b/src/base/digitseq/cl_DS_mul_fftcs.h @@ -273,7 +273,7 @@ #include "cln/exception.h" -#if defined(HAVE_LONGDOUBLE) && (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) +#if (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) // Only these CPUs have fast "long double"s in hardware. // On SPARC, "long double"s are emulated in software and don't work. typedef long double fftcs_real; diff --git a/src/base/digitseq/cl_DS_mul_fftr.h b/src/base/digitseq/cl_DS_mul_fftr.h index d99da53..674edd7 100644 --- a/src/base/digitseq/cl_DS_mul_fftr.h +++ b/src/base/digitseq/cl_DS_mul_fftr.h @@ -200,7 +200,7 @@ #include "cln/exception.h" -#if defined(HAVE_LONGDOUBLE) && (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) +#if (long_double_mant_bits > double_mant_bits) && (defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && 0)) // Only these CPUs have fast "long double"s in hardware. // On SPARC, "long double"s are emulated in software and don't work. typedef long double fftr_real; diff --git a/src/base/low/cl_low_isqrt.cc b/src/base/low/cl_low_isqrt.cc index b9fb99c..3a43813 100644 --- a/src/base/low/cl_low_isqrt.cc +++ b/src/base/low/cl_low_isqrt.cc @@ -61,7 +61,6 @@ uintL isqrt (uintL x) }} } -#ifdef HAVE_LONGLONG uintL isqrt (uintQ x) { // As isqrt (uintL) above, but with 64-bit numbers. @@ -94,6 +93,5 @@ uintL isqrt (uintQ x) } }} } -#endif } // namespace cln diff --git a/src/base/output/cl_output_dec.cc b/src/base/output/cl_output_dec.cc index 919327b..90679b2 100644 --- a/src/base/output/cl_output_dec.cc +++ b/src/base/output/cl_output_dec.cc @@ -58,8 +58,6 @@ void fprintdecimal (std::ostream& stream, long x) fprintdecimal_impl(stream,(intptr_t)x); } -#ifdef HAVE_LONGLONG - void fprintdecimal (std::ostream& stream, unsigned long long x) { #if long_long_bitsize <= pointer_bitsize @@ -94,6 +92,4 @@ void fprintdecimal (std::ostream& stream, long long x) #endif } -#endif - } // namespace cln diff --git a/src/base/output/cl_output_hex.cc b/src/base/output/cl_output_hex.cc index 69a6f56..c823bbf 100644 --- a/src/base/output/cl_output_hex.cc +++ b/src/base/output/cl_output_hex.cc @@ -55,8 +55,6 @@ void fprinthexadecimal (std::ostream& stream, long x) fprinthexadecimal_impl(stream,(intptr_t)x); } -#ifdef HAVE_LONGLONG - void fprinthexadecimal (std::ostream& stream, unsigned long long x) { #if long_long_bitsize <= pointer_bitsize @@ -91,6 +89,4 @@ void fprinthexadecimal (std::ostream& stream, long long x) #endif } -#endif - } // namespace cln -- 2.49.0