From 67ef1925574808e63692e6f0df5a45117523624c Mon Sep 17 00:00:00 2001 From: Lorenzo Moneta <Lorenzo.Moneta@cern.ch> Date: Tue, 3 Sep 2013 16:31:14 +0200 Subject: [PATCH] port changes from Matthias in vc branch: after fixing the Vc ROOT import script: here are the missing changes --- math/vc/include/Vc/Allocator | 23 ++++++++++++++--------- math/vc/include/Vc/IO | 28 ++++++++++++++-------------- math/vc/include/Vc/Utils | 1 - 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/math/vc/include/Vc/Allocator b/math/vc/include/Vc/Allocator index 28400036c68..0342f18d6f3 100644 --- a/math/vc/include/Vc/Allocator +++ b/math/vc/include/Vc/Allocator @@ -24,9 +24,11 @@ #include <cstddef> #include <cstdlib> #include "common/macros.h" +#ifdef VC_CXX11 #include <utility> +#endif -/*OUTER_NAMESPACE_BEGIN*/ +namespace ROOT { namespace Vc { using std::size_t; @@ -45,7 +47,7 @@ namespace Vc #define VC_DECLARE_ALLOCATOR(Type) \ namespace std \ { \ - template<> class allocator<Type> : public ::Vc::Allocator<Type> \ + template<> class allocator<Type> : public ::ROOT::Vc::Allocator<Type> \ { \ public: \ template<typename U> struct rebind { typedef ::std::allocator<U> other; }; \ @@ -56,7 +58,7 @@ namespace std \ #define Vc_DECLARE_ALLOCATOR(Type) \ namespace std \ { \ - template<> class allocator<Type> : public ::Vc::Allocator<Type> \ + template<> class allocator<Type> : public ::ROOT::Vc::Allocator<Type> \ { \ public: \ template<typename U> struct rebind { typedef ::std::allocator<U> other; }; \ @@ -120,10 +122,10 @@ namespace std \ #elif defined(VC_HAVE_MAX_ALIGN_T) NaturalAlignment = alignof(::max_align_t), #else - NaturalAlignment = sizeof(void *) > alignof(long double) ? sizeof(void *) : - (alignof(long double) > alignof(long long) ? alignof(long double) : alignof(long long)), + NaturalAlignment = sizeof(void *) > Vc_ALIGNOF(long double) ? sizeof(void *) : + (Vc_ALIGNOF(long double) > Vc_ALIGNOF(long long) ? Vc_ALIGNOF(long double) : Vc_ALIGNOF(long long)), #endif - Alignment = alignof(T), + Alignment = Vc_ALIGNOF(T), /* The number of extra bytes allocated must be large enough to put a pointer right * before the adjusted address. This pointer stores the original address, which is * required to call ::operator delete in deallocate. @@ -199,12 +201,15 @@ namespace std \ // we still need the C++98 version: void construct(pointer p, const T& __val) { ::new(p) T(__val); } void destroy(pointer p) { p->~T(); } -#else +#elif defined(VC_CXX11) template<typename U, typename... Args> void construct(U* p, Args&&... args) { ::new(p) U(std::forward<Args>(args)...); } template<typename U> void destroy(U* p) { p->~U(); } +#else + void construct(pointer p, const T& __val) { ::new(p) T(__val); } + void destroy(pointer p) { p->~T(); } #endif }; @@ -212,13 +217,13 @@ namespace std \ template<typename T> inline bool operator!=(const Allocator<T>&, const Allocator<T>&) { return false; } } // namespace Vc -/*OUTER_NAMESPACE_END*/ +} // namespace ROOT #include "common/undomacros.h" #include "vector.h" namespace std { - template<typename T> class allocator<Vc::Vector<T> > : public ::Vc::Allocator<Vc::Vector<T> > + template<typename T> class allocator<Vc::Vector<T> > : public ::ROOT::Vc::Allocator<Vc::Vector<T> > { public: template<typename U> struct rebind { typedef ::std::allocator<U> other; }; diff --git a/math/vc/include/Vc/IO b/math/vc/include/Vc/IO index 7dbfce28369..9d645169b7a 100644 --- a/math/vc/include/Vc/IO +++ b/math/vc/include/Vc/IO @@ -24,15 +24,13 @@ #include "Memory" #include <iostream> -#if defined(__GNUC__) && !defined(_WIN32) -#define VC_HACK_OSTREAM_FOR_TTY 1 -#endif - -#ifdef VC_HACK_OSTREAM_FOR_TTY +#ifdef __GNUC__ #include <unistd.h> #include <ext/stdio_sync_filebuf.h> #endif +#include "internal/namespace.h" + namespace { namespace AnsiColor @@ -44,7 +42,7 @@ namespace static const Type normal = { "\033[0m" }; } // namespace AnsiColor -#ifdef VC_HACK_OSTREAM_FOR_TTY +#ifdef __GNUC__ class hacked_ostream : public std::ostream { public: @@ -78,7 +76,7 @@ static inline std::ostream &operator<<(std::ostream &out, const AnsiColor::Type } template<typename T> -static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE::Vector<T> &v) +static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<T> &v) { out << AnsiColor::green << "["; out << v[0]; @@ -89,7 +87,7 @@ static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE:: return out; } -static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE::Vector<char> &v) +static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<char> &v) { out << AnsiColor::green << "["; out << int(v[0]); @@ -99,7 +97,7 @@ static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE:: out << "]" << AnsiColor::normal; return out; } -static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE::Vector<unsigned char> &v) +static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Vector<unsigned char> &v) { out << AnsiColor::green << "["; out << int(v[0]); @@ -112,18 +110,18 @@ static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE:: #ifdef VC_HAVE_FMA template<typename T> -static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE::VectorMultiplication<T> &v) +static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::VectorMultiplication<T> &v) { - return out << Vc::Vc_IMPL_NAMESPACE::Vector<T>(v); + return out << VECTOR_NAMESPACE::Vector<T>(v); } #endif #ifdef VC_IMPL_AVX template<unsigned int VectorSize, size_t RegisterWidth> -static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE::Mask<VectorSize, RegisterWidth> &m) +static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Mask<VectorSize, RegisterWidth> &m) #else template<unsigned int VectorSize> -static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE::Mask<VectorSize> &m) +static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Mask<VectorSize> &m) #endif { out << AnsiColor::blue << "m["; @@ -141,7 +139,7 @@ static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE:: return out; } #ifdef VC_IMPL_SSE -static std::ostream &operator<<(std::ostream &out, const Vc::Vc_IMPL_NAMESPACE::Float8Mask &m) +static std::ostream &operator<<(std::ostream &out, const VECTOR_NAMESPACE::Float8Mask &m) { out << AnsiColor::blue << "m["; for (unsigned int i = 0; i < 8; ++i) { @@ -188,6 +186,8 @@ static std::ostream &operator<<(std::ostream &out, const Vc::MemoryBase<V, Paren } } // namespace std +#undef VECTOR_NAMESPACE + #endif // VECIO_H // vim: ft=cpp diff --git a/math/vc/include/Vc/Utils b/math/vc/include/Vc/Utils index 4ae2b258575..ef5a0eaad86 100644 --- a/math/vc/include/Vc/Utils +++ b/math/vc/include/Vc/Utils @@ -29,6 +29,5 @@ #endif #include "common/deinterleave.h" -#include "common/makeContainer.h" #endif // VC_UTILS -- GitLab