]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - Vc/include/Vc/common/aliasingentryhelper.h
update to Vc 0.7.3-dev
[u/mrichter/AliRoot.git] / Vc / include / Vc / common / aliasingentryhelper.h
index d28855b291e2c6decf72a02801190b127f16f86f..0dd8c726207452117da4527452f24d4839a557b7 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "macros.h"
 
+namespace AliRoot {
 namespace Vc
 {
 namespace Common
@@ -35,70 +36,80 @@ template<class StorageType> class AliasingEntryHelper
         StorageType *const m_storage;
         const int m_index;
     public:
-        AliasingEntryHelper(StorageType *d, int index) : m_storage(d), m_index(index) {}
-        AliasingEntryHelper(const AliasingEntryHelper &rhs) : m_storage(rhs.m_storage), m_index(rhs.m_index) {}
-        AliasingEntryHelper &operator=(const AliasingEntryHelper &rhs) {
+        Vc_ALWAYS_INLINE AliasingEntryHelper(StorageType *d, int index) : m_storage(d), m_index(index) {}
+        Vc_ALWAYS_INLINE AliasingEntryHelper(const AliasingEntryHelper &rhs) : m_storage(rhs.m_storage), m_index(rhs.m_index) {}
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator=(const AliasingEntryHelper &rhs) {
             m_storage->assign(m_index, rhs);
             return *this;
         }
 
-        AliasingEntryHelper &operator  =(T x) { m_storage->assign(m_index, x); return *this; }
-        AliasingEntryHelper &operator +=(T x) { m_storage->assign(m_index, m_storage->m(m_index) + x); return *this; }
-        AliasingEntryHelper &operator -=(T x) { m_storage->assign(m_index, m_storage->m(m_index) - x); return *this; }
-        AliasingEntryHelper &operator /=(T x) { m_storage->assign(m_index, m_storage->m(m_index) / x); return *this; }
-        AliasingEntryHelper &operator *=(T x) { m_storage->assign(m_index, m_storage->m(m_index) * x); return *this; }
-        AliasingEntryHelper &operator |=(T x) { m_storage->assign(m_index, m_storage->m(m_index) | x); return *this; }
-        AliasingEntryHelper &operator &=(T x) { m_storage->assign(m_index, m_storage->m(m_index) & x); return *this; }
-        AliasingEntryHelper &operator ^=(T x) { m_storage->assign(m_index, m_storage->m(m_index) ^ x); return *this; }
-        AliasingEntryHelper &operator %=(T x) { m_storage->assign(m_index, m_storage->m(m_index) % x); return *this; }
-        AliasingEntryHelper &operator<<=(T x) { m_storage->assign(m_index, m_storage->m(m_index)<< x); return *this; }
-        AliasingEntryHelper &operator>>=(T x) { m_storage->assign(m_index, m_storage->m(m_index)>> x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator  =(T x) { m_storage->assign(m_index, x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator +=(T x) { m_storage->assign(m_index, m_storage->m(m_index) + x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator -=(T x) { m_storage->assign(m_index, m_storage->m(m_index) - x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator /=(T x) { m_storage->assign(m_index, m_storage->m(m_index) / x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator *=(T x) { m_storage->assign(m_index, m_storage->m(m_index) * x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator |=(T x) { m_storage->assign(m_index, m_storage->m(m_index) | x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator &=(T x) { m_storage->assign(m_index, m_storage->m(m_index) & x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator ^=(T x) { m_storage->assign(m_index, m_storage->m(m_index) ^ x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator %=(T x) { m_storage->assign(m_index, m_storage->m(m_index) % x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator<<=(T x) { m_storage->assign(m_index, m_storage->m(m_index)<< x); return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator>>=(T x) { m_storage->assign(m_index, m_storage->m(m_index)>> x); return *this; }
+
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator++() { m_storage->assign(m_index, m_storage->m(m_index) + T(1)); return *this; }
+        Vc_ALWAYS_INLINE T operator++(int) { T r = m_storage->m(m_index); m_storage->assign(m_index, m_storage->m(m_index) + T(1)); return r; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator--() { m_storage->assign(m_index, m_storage->m(m_index) - T(1)); return *this; }
+        Vc_ALWAYS_INLINE T operator--(int) { T r = m_storage->m(m_index); m_storage->assign(m_index, m_storage->m(m_index) - T(1)); return r; }
 #define m_data m_storage->read(m_index)
 #else
-        typedef T A MAY_ALIAS;
+        typedef T A Vc_MAY_ALIAS;
         A &m_data;
     public:
         template<typename T2>
-        AliasingEntryHelper(T2 &d) : m_data(reinterpret_cast<A &>(d)) {}
+        Vc_ALWAYS_INLINE AliasingEntryHelper(T2 &d) : m_data(reinterpret_cast<A &>(d)) {}
 
-        AliasingEntryHelper(A &d) : m_data(d) {}
-        AliasingEntryHelper &operator=(const AliasingEntryHelper &rhs) {
+        Vc_ALWAYS_INLINE AliasingEntryHelper(A &d) : m_data(d) {}
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator=(const AliasingEntryHelper &rhs) {
             m_data = rhs.m_data;
             return *this;
         }
 
-        AliasingEntryHelper &operator =(T x) { m_data  = x; return *this; }
-        AliasingEntryHelper &operator+=(T x) { m_data += x; return *this; }
-        AliasingEntryHelper &operator-=(T x) { m_data -= x; return *this; }
-        AliasingEntryHelper &operator/=(T x) { m_data /= x; return *this; }
-        AliasingEntryHelper &operator*=(T x) { m_data *= x; return *this; }
-        AliasingEntryHelper &operator|=(T x) { m_data |= x; return *this; }
-        AliasingEntryHelper &operator&=(T x) { m_data &= x; return *this; }
-        AliasingEntryHelper &operator^=(T x) { m_data ^= x; return *this; }
-        AliasingEntryHelper &operator%=(T x) { m_data %= x; return *this; }
-        AliasingEntryHelper &operator<<=(T x) { m_data <<= x; return *this; }
-        AliasingEntryHelper &operator>>=(T x) { m_data >>= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator =(T x) { m_data  = x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator+=(T x) { m_data += x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator-=(T x) { m_data -= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator/=(T x) { m_data /= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator*=(T x) { m_data *= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator|=(T x) { m_data |= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator&=(T x) { m_data &= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator^=(T x) { m_data ^= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator%=(T x) { m_data %= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator<<=(T x) { m_data <<= x; return *this; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator>>=(T x) { m_data >>= x; return *this; }
+
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator++() { ++m_data; return *this; }
+        Vc_ALWAYS_INLINE T operator++(int) { T r = m_data; ++m_data; return r; }
+        Vc_ALWAYS_INLINE AliasingEntryHelper &operator--() { --m_data; return *this; }
+        Vc_ALWAYS_INLINE T operator--(int) { T r = m_data; --m_data; return r; }
 #endif
 
-        operator const T() const { return m_data; }
-
-        bool operator==(T x) const { return static_cast<T>(m_data) == x; }
-        bool operator!=(T x) const { return static_cast<T>(m_data) != x; }
-        bool operator<=(T x) const { return static_cast<T>(m_data) <= x; }
-        bool operator>=(T x) const { return static_cast<T>(m_data) >= x; }
-        bool operator< (T x) const { return static_cast<T>(m_data) <  x; }
-        bool operator> (T x) const { return static_cast<T>(m_data) >  x; }
-
-        T operator-() const { return -static_cast<T>(m_data); }
-        T operator~() const { return ~static_cast<T>(m_data); }
-        T operator+(T x) const { return static_cast<T>(m_data) + x; }
-        T operator-(T x) const { return static_cast<T>(m_data) - x; }
-        T operator/(T x) const { return static_cast<T>(m_data) / x; }
-        T operator*(T x) const { return static_cast<T>(m_data) * x; }
-        T operator|(T x) const { return static_cast<T>(m_data) | x; }
-        T operator&(T x) const { return static_cast<T>(m_data) & x; }
-        T operator^(T x) const { return static_cast<T>(m_data) ^ x; }
-        T operator%(T x) const { return static_cast<T>(m_data) % x; }
+        Vc_ALWAYS_INLINE Vc_PURE operator const T() const { return m_data; }
+
+        Vc_ALWAYS_INLINE Vc_PURE bool operator==(T x) const { return static_cast<T>(m_data) == x; }
+        Vc_ALWAYS_INLINE Vc_PURE bool operator!=(T x) const { return static_cast<T>(m_data) != x; }
+        Vc_ALWAYS_INLINE Vc_PURE bool operator<=(T x) const { return static_cast<T>(m_data) <= x; }
+        Vc_ALWAYS_INLINE Vc_PURE bool operator>=(T x) const { return static_cast<T>(m_data) >= x; }
+        Vc_ALWAYS_INLINE Vc_PURE bool operator< (T x) const { return static_cast<T>(m_data) <  x; }
+        Vc_ALWAYS_INLINE Vc_PURE bool operator> (T x) const { return static_cast<T>(m_data) >  x; }
+
+        Vc_ALWAYS_INLINE Vc_PURE T operator-() const { return -static_cast<T>(m_data); }
+        Vc_ALWAYS_INLINE Vc_PURE T operator~() const { return ~static_cast<T>(m_data); }
+        Vc_ALWAYS_INLINE Vc_PURE T operator+(T x) const { return static_cast<T>(m_data) + x; }
+        Vc_ALWAYS_INLINE Vc_PURE T operator-(T x) const { return static_cast<T>(m_data) - x; }
+        Vc_ALWAYS_INLINE Vc_PURE T operator/(T x) const { return static_cast<T>(m_data) / x; }
+        Vc_ALWAYS_INLINE Vc_PURE T operator*(T x) const { return static_cast<T>(m_data) * x; }
+        Vc_ALWAYS_INLINE Vc_PURE T operator|(T x) const { return static_cast<T>(m_data) | x; }
+        Vc_ALWAYS_INLINE Vc_PURE T operator&(T x) const { return static_cast<T>(m_data) & x; }
+        Vc_ALWAYS_INLINE Vc_PURE T operator^(T x) const { return static_cast<T>(m_data) ^ x; }
+        Vc_ALWAYS_INLINE Vc_PURE T operator%(T x) const { return static_cast<T>(m_data) % x; }
         //T operator<<(T x) const { return static_cast<T>(m_data) << x; }
         //T operator>>(T x) const { return static_cast<T>(m_data) >> x; }
 #ifdef m_data
@@ -108,6 +119,7 @@ template<class StorageType> class AliasingEntryHelper
 
 } // namespace Common
 } // namespace Vc
+} // namespace AliRoot
 
 #include "undomacros.h"