]> www.ginac.de Git - cln.git/commitdiff
64-bit mingw port: size_t may be larger than 'unsigned long'.
authorBruno Haible <bruno@clisp.org>
Sun, 27 Oct 2019 18:47:06 +0000 (19:47 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 27 Oct 2019 18:47:06 +0000 (19:47 +0100)
include/cln/GV.h
include/cln/SV.h

index 338edfa27300bc4900c1e606d0609f0baf111280..3e450900df2d7b8d147fab9cdad27c23e23d381f 100644 (file)
@@ -38,6 +38,12 @@ public:
        const cl_GV_constindex<T> operator[] (unsigned int index) const;
        const cl_GV_index<T> operator[] (int index);
        const cl_GV_constindex<T> operator[] (int index) const;
+       #if long_bitsize < pointer_bitsize
+       const cl_GV_index<T> operator[] (unsigned long long index);
+       const cl_GV_constindex<T> operator[] (unsigned long long index) const;
+       const cl_GV_index<T> operator[] (long long index);
+       const cl_GV_constindex<T> operator[] (long long index) const;
+       #endif
 public: /* ugh */
        // Constructor.
        cl_GV_inner (std::size_t l, cl_GV_vectorops<T>* ops) : len (l), vectorops (ops) {}
@@ -163,6 +169,34 @@ inline const cl_GV_constindex<T> cl_GV_inner<T>::operator[] (int index) const
        return operator[]((unsigned long)index);
 }
 
+#if long_bitsize < pointer_bitsize
+
+template <class T>
+inline const cl_GV_index<T> cl_GV_inner<T>::operator[] (unsigned long long index)
+{
+       return cl_GV_index<T>(this,index);
+}
+
+template <class T>
+inline const cl_GV_constindex<T> cl_GV_inner<T>::operator[] (unsigned long long index) const
+{
+       return cl_GV_constindex<T>(this,index);
+}
+
+template <class T>
+inline const cl_GV_index<T> cl_GV_inner<T>::operator[] (long long index)
+{
+       return operator[]((unsigned long)index);
+}
+
+template <class T>
+inline const cl_GV_constindex<T> cl_GV_inner<T>::operator[] (long long index) const
+{
+       return operator[]((unsigned long)index);
+}
+
+#endif
+
 template <class T>
 inline cl_GV_inner<T>::~cl_GV_inner ()
 {
@@ -245,6 +279,20 @@ public:
        { return operator[]((unsigned long)index); }
        const cl_GV_index<T> operator[] (int index)
        { return operator[]((unsigned long)index); }
+       #if long_bitsize < pointer_bitsize
+       const cl_GV_constindex<T> operator[] (unsigned long long index) const
+       {
+               return ((const cl_heap_GV<T> *) this->pointer)->v[index];
+       }
+       const cl_GV_index<T> operator[] (unsigned long long index)
+       {
+               return ((cl_heap_GV<T> *) this->pointer)->v[index];
+       }
+       const cl_GV_constindex<T> operator[] (long long index) const
+       { return operator[]((unsigned long long)index); }
+       const cl_GV_index<T> operator[] (long long index)
+       { return operator[]((unsigned long long)index); }
+       #endif
        // Copy constructor.
        cl_GV (const cl_GV&);
        // Assignment operator.
index 7c5761425d3c7a1b447b8214e95ef3d0b47aa77f..e4e785ee1e8c80d0023b9a1d77c492c93b856eff 100644 (file)
@@ -75,6 +75,26 @@ public:
        { return operator[]((unsigned long)index); }
        T & operator[] (int index)
        { return operator[]((unsigned long)index); }
+       #if long_bitsize < pointer_bitsize
+       const T & operator[] (unsigned long long index) const
+       {
+               #ifndef CL_SV_NO_RANGECHECKS
+               if (!(index < size())) throw runtime_exception();
+               #endif
+               return data()[index];
+       }
+       T & operator[] (unsigned long long index)
+       {
+               #ifndef CL_SV_NO_RANGECHECKS
+               if (!(index < size())) throw runtime_exception();
+               #endif
+               return data()[index];
+       }
+       const T & operator[] (long long index) const
+       { return operator[]((unsigned long long)index); }
+       T & operator[] (long long index)
+       { return operator[]((unsigned long long)index); }
+       #endif
 public: /* ugh */
        // Constructor.
        cl_SV_inner (std::size_t l) : len (l) {}
@@ -142,6 +162,20 @@ public:
        { return operator[]((unsigned long)index); }
        T & operator[] (int index)
        { return operator[]((unsigned long)index); }
+       #if long_bitsize < pointer_bitsize
+       const T & operator[] (unsigned long long index) const
+       {
+               return ((const cl_heap_SV<T> *) this->pointer)->v[index];
+       }
+       T & operator[] (unsigned long long index)
+       {
+               return ((cl_heap_SV<T> *) this->pointer)->v[index];
+       }
+       const T & operator[] (long long index) const
+       { return operator[]((unsigned long long)index); }
+       T & operator[] (long long index)
+       { return operator[]((unsigned long long)index); }
+       #endif
        // Constructors.
        cl_SV (const cl_SV&);
        // Assignment operators.