//-*- Mode: C++ -*- //* This file is property of and copyright by the ALICE HLT Project * //* ALICE Experiment at CERN, All rights reserved. * //* See cxx source for full Copyright notice * #ifndef PNDCADEF_H #define PNDCADEF_H #include using std::cout; using std::endl; #include #include using ::Vc::double_v; using ::Vc::float_v; //using ::Vc::sfloat_v; using ::Vc::int_v; using ::Vc::uint_v; //using ::Vc::short_v; //using ::Vc::ushort_v; using ::Vc::VectorAlignment; using ::Vc::double_m; using ::Vc::float_m; //using ::Vc::sfloat_m; using ::Vc::int_m; using ::Vc::uint_m; //using ::Vc::short_m; //using ::Vc::ushort_m; /** * Definitions needed for PndCATracker * */ #if defined(HLTCA_STANDALONE) typedef unsigned char UChar_t; typedef UChar_t Byte_t; typedef int Int_t; typedef double Double_t; #else #include "Rtypes.h" #endif // according to http://stackoverflow.com/questions/1903954/is-there-a-standard-sign-function-signum-sgn-in-c-c template int sign(T val) { return (T(0) < val) - (val < T(0)); } #ifdef NDEBUG #define ASSERT(v, msg) #else #define ASSERT(v, msg) \ if (v) {} else { \ std::cerr << __FILE__ << ":" << __LINE__ << " assertion failed: " \ << #v << " = " << (v) << "\n" << msg << std::endl; \ abort(); \ } #endif struct float2 { float x; float y; }; /* * Helper for compile-time verification of correct API usage */ namespace { template struct HLTTPCCA_STATIC_ASSERT_FAILURE; template<> struct HLTTPCCA_STATIC_ASSERT_FAILURE {}; } #define HLTTPCCA_STATIC_ASSERT_CONCAT_HELPER(a, b) a##b #define HLTTPCCA_STATIC_ASSERT_CONCAT(a, b) HLTTPCCA_STATIC_ASSERT_CONCAT_HELPER(a, b) #define STATIC_ASSERT(cond, msg) \ typedef HLTTPCCA_STATIC_ASSERT_FAILURE HLTTPCCA_STATIC_ASSERT_CONCAT(_STATIC_ASSERTION_FAILED_##msg, __LINE__); \ HLTTPCCA_STATIC_ASSERT_CONCAT(_STATIC_ASSERTION_FAILED_##msg, __LINE__) Error_##msg; \ (void) Error_##msg namespace { template void UNUSED_PARAM1( const T1 & ) {} template void UNUSED_PARAM2( const T1 &, const T2 & ) {} template void UNUSED_PARAM3( const T1 &, const T2 &, const T3 & ) {} template void UNUSED_PARAM4( const T1 &, const T2 &, const T3 &, const T4 & ) {} template void UNUSED_PARAM5( const T1 &, const T2 &, const T3 &, const T4 &, const T5 & ) {} template void UNUSED_PARAM6( const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 & ) {} template void UNUSED_PARAM7( const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 & ) {} template void UNUSED_PARAM8( const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &, const T8 & ) {} template void UNUSED_PARAM9( const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &, const T8 &, const T9 & ) {} } #define unrolled_loop4( _type_, _it_, _start_, _end_, _code_ ) \ if (_start_ + 0 < _end_) { enum { _it_ = (_start_ + 0) < _end_ ? (_start_ + 0) : _start_ }; _code_ } \ if (_start_ + 1 < _end_) { enum { _it_ = (_start_ + 1) < _end_ ? (_start_ + 1) : _start_ }; _code_ } \ if (_start_ + 2 < _end_) { enum { _it_ = (_start_ + 2) < _end_ ? (_start_ + 2) : _start_ }; _code_ } \ if (_start_ + 3 < _end_) { enum { _it_ = (_start_ + 3) < _end_ ? (_start_ + 3) : _start_ }; _code_ } \ do {} while ( false ) #ifdef __GNUC__ #define MAY_ALIAS __attribute__((__may_alias__)) #else #define MAY_ALIAS #endif #if defined( __GNUC__ ) && __GNUC__ - 0 >= 3 # define ISLIKELY( x ) __builtin_expect( !!( x ),1 ) # define ISUNLIKELY( x ) __builtin_expect( !!( x ),0 ) #else # define ISLIKELY( x ) ( x ) # define ISUNLIKELY( x ) ( x ) #endif #endif