]> www.ginac.de Git - ginac.git/commitdiff
Remove extra cases for missing <stdint.h>.
authorRichard Kreckel <kreckel@ginac.de>
Sun, 31 Jan 2016 09:15:50 +0000 (10:15 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Sun, 31 Jan 2016 09:15:50 +0000 (10:15 +0100)
Use <cstdint> unconditionally -- it's been standardized in C++11.

CMakeLists.txt
acinclude.m4
config.cmake.in
ginac/constant.cpp
ginac/hash_seed.h
ginac/parser/default_reader.cpp
ginac/parser/parser.cpp
ginac/utils.h

index 122d94cad70699ab332c59438abb4e52a18f2fd0..1c532668bc180daf8535cf0e3f204472ef0a882c 100644 (file)
@@ -29,7 +29,6 @@ find_package(CLN 1.2.2 REQUIRED)
 include_directories(${CLN_INCLUDE_DIR})
 
 include(CheckIncludeFile)
 include_directories(${CLN_INCLUDE_DIR})
 
 include(CheckIncludeFile)
-check_include_file("stdint.h" HAVE_STDINT_H)
 check_include_file("unistd.h" HAVE_UNISTD_H)
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/ginac)
 check_include_file("unistd.h" HAVE_UNISTD_H)
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/ginac)
index c66f3dda84be1cf96610da94f3319f812c182bf1..5471a53c455ac37d0d7377a40470553aef1bc63d 100644 (file)
@@ -32,6 +32,7 @@ AC_CACHE_CHECK([for standard C++ header files], [ginac_cv_std_cxx_headers], [
                #include <algorithm>
                #include <cstring>
                #include <cstddef>
                #include <algorithm>
                #include <cstring>
                #include <cstddef>
+               #include <cstdint>
                #include <ctime>
                #include <fstream>
                #include <functional>
                #include <ctime>
                #include <fstream>
                #include <functional>
index b2589ee5a702688af33aa2571fc458a77b4f84d0..cef416b824827ee9fc01a78bc712bb171496c4b0 100644 (file)
@@ -1,4 +1,3 @@
-#cmakedefine HAVE_STDINT_H
 #cmakedefine HAVE_UNISTD_H
 #cmakedefine HAVE_LIBREADLINE
 #cmakedefine HAVE_READLINE_READLINE_H
 #cmakedefine HAVE_UNISTD_H
 #cmakedefine HAVE_LIBREADLINE
 #cmakedefine HAVE_READLINE_READLINE_H
index 44acf4ccb2f1d64d1cbcebc6d7772c04dff4c2a3..3b1f289ca6d018518ddab3b5bed0f3ac7bf6dffc 100644 (file)
@@ -216,7 +216,7 @@ bool constant::is_equal_same_type(const basic & other) const
 unsigned constant::calchash() const
 {
        const void* typeid_this = (const void*)typeid(*this).name();
 unsigned constant::calchash() const
 {
        const void* typeid_this = (const void*)typeid(*this).name();
-       hashvalue = golden_ratio_hash((p_int)typeid_this ^ serial);
+       hashvalue = golden_ratio_hash((uintptr_t)typeid_this ^ serial);
 
        setflag(status_flags::hash_calculated);
 
 
        setflag(status_flags::hash_calculated);
 
index c0fb4b8904c0c247311d35c799207474bbcff1f8..9b163cf86010952ab40289682763657228842ef2 100644 (file)
@@ -38,7 +38,7 @@ static inline unsigned make_hash_seed(const std::type_info& tinfo)
        // This pointer is the same for all objects of the same type.
        // Hence we can use it.
        const void* mangled_name_ptr = (const void*)tinfo.name();
        // This pointer is the same for all objects of the same type.
        // Hence we can use it.
        const void* mangled_name_ptr = (const void*)tinfo.name();
-       unsigned v = golden_ratio_hash((p_int)mangled_name_ptr);
+       unsigned v = golden_ratio_hash((uintptr_t)mangled_name_ptr);
        return v;
 }
 #else
        return v;
 }
 #else
index 20996f97435a20a63e6389ac6a273e0085535a4e..53826ac1fbd62777cb5e3c07b53c331a56a0ef26 100644 (file)
 #include "lst.h"
 #include "operators.h"
 #include "inifcns.h"
 #include "lst.h"
 #include "operators.h"
 #include "inifcns.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 
 
-#ifdef HAVE_STDINT_H
-#include <stdint.h> // for uintptr_t
-#endif
+#include <cstdint> // for uintptr_t
 
 namespace GiNaC
 {
 
 namespace GiNaC
 {
index 9e231d8e1aa288b8fe443a48195886b4923d0285..fe4e1747512f60924274286cd363df244c9be7d8 100644 (file)
 #include "mul.h"
 #include "constant.h"
 #include "function.h"
 #include "mul.h"
 #include "constant.h"
 #include "function.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 
 
-#ifdef HAVE_STDINT_H
-#include <stdint.h> // for uintptr_t
-#endif
+#include <cstdint> // for uintptr_t
 #include <sstream>
 #include <stdexcept>
 
 #include <sstream>
 #include <stdexcept>
 
index 61d35000ba1fb967e04d4e9a93222c1e5041cea0..25af815c447d38d45bde664514f34c68aa329e67 100644 (file)
 #define GINAC_UTILS_H
 
 #include "assertion.h"
 #define GINAC_UTILS_H
 
 #include "assertion.h"
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 
 #include <functional>
 
 #include <functional>
-#ifdef HAVE_STDINT_H
-#include <stdint.h> // for uintptr_t
-#endif
+#include <cstdint> // for uintptr_t
 #include <string>
 
 namespace GiNaC {
 #include <string>
 
 namespace GiNaC {
@@ -69,37 +64,10 @@ inline int compare_pointers(const T * a, const T * b)
        return 0;
 }
 
        return 0;
 }
 
-#ifdef HAVE_STDINT_H
-typedef uintptr_t p_int;
-#else
-typedef unsigned long p_int;
-#endif
-
 /** Truncated multiplication with golden ratio, for computing hash values. */
 /** Truncated multiplication with golden ratio, for computing hash values. */
-inline unsigned golden_ratio_hash(p_int n)
+inline unsigned golden_ratio_hash(uintptr_t n)
 {
 {
-       // This function works much better when fast arithmetic with at
-       // least 64 significant bits is available.
-       if (sizeof(long) >= 8) {
-       // So 'long' has 64 bits.  Excellent!  We prefer it because it might be
-       // more efficient than 'long long'.
-       unsigned long l = n * 0x4f1bbcddUL;
-       return (unsigned)l;
-       }
-#ifdef HAVE_LONG_LONG
-       else if (sizeof(long long) >= 8) {
-       // This requires 'long long' (or an equivalent 64 bit type)---which is,
-       // unfortunately, not ANSI-C++-compliant.
-       // (Yet C99 demands it, which is reason for hope.)
-       unsigned long long l = n * 0x4f1bbcddULL;
-       return (unsigned)l;
-       }
-#endif
-       // Without a type with 64 significant bits do the multiplication manually
-       // by splitting n up into the lower and upper two bytes.
-       const unsigned n0 = (n & 0x0000ffffU);
-       const unsigned n1 = (n & 0xffff0000U) >> 16;
-       return (n0 * 0x0000bcddU) + ((n1 * 0x0000bcddU + n0 * 0x00004f1bU) << 16);
+       return n * UINT64_C(0x4f1bbcdd);
 }
 
 /* Compute the sign of a permutation of a container, with and without an
 }
 
 /* Compute the sign of a permutation of a container, with and without an