]> git.uio.no Git - u/mrichter/AliRoot.git/blob - Vc/include/Vc/avx/const_data.h
12c6463e00cd25aa12feedb97a9d485472ccd281
[u/mrichter/AliRoot.git] / Vc / include / Vc / avx / const_data.h
1 /*  This file is part of the Vc library. {{{
2
3     Copyright (C) 2012 Matthias Kretz <kretz@kde.org>
4
5     Vc is free software: you can redistribute it and/or modify
6     it under the terms of the GNU Lesser General Public License as
7     published by the Free Software Foundation, either version 3 of
8     the License, or (at your option) any later version.
9
10     Vc is distributed in the hope that it will be useful, but
11     WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with Vc.  If not, see <http://www.gnu.org/licenses/>.
17
18 }}}*/
19
20 #ifndef VC_AVX_CONST_DATA_H
21 #define VC_AVX_CONST_DATA_H
22
23 #include "macros.h"
24 namespace AliRoot {
25 namespace Vc
26 {
27 namespace AVX
28 {
29
30 ALIGN(64) extern const unsigned int   _IndexesFromZero32[8];
31 ALIGN(16) extern const unsigned short _IndexesFromZero16[8];
32 ALIGN(16) extern const unsigned char  _IndexesFromZero8[16];
33
34 struct STRUCT_ALIGN1(64) c_general
35 {
36     static const float oneFloat;
37     static const unsigned int absMaskFloat[2];
38     static const unsigned int signMaskFloat[2];
39     static const unsigned int highMaskFloat;
40     static const unsigned short minShort[2];
41     static const unsigned short one16[2];
42     static const float _2power31;
43     static const double oneDouble;
44     static const unsigned long long frexpMask;
45     static const unsigned long long highMaskDouble;
46 } STRUCT_ALIGN2(64);
47
48 template<typename T> struct c_trig
49 {
50     ALIGN(64) static const T data[];
51 };
52
53 template<typename T> struct c_log
54 {
55     typedef float floatAlias Vc_MAY_ALIAS;
56     static Vc_ALWAYS_INLINE float d(int i) { return *reinterpret_cast<const floatAlias *>(&data[i]); }
57     ALIGN(64) static const unsigned int data[];
58 };
59
60 template<> struct c_log<double>
61 {
62     enum VectorSize { Size = 16 / sizeof(double) };
63     typedef double doubleAlias Vc_MAY_ALIAS;
64     static Vc_ALWAYS_INLINE double d(int i) { return *reinterpret_cast<const doubleAlias *>(&data[i]); }
65     ALIGN(64) static const unsigned long long data[];
66 };
67
68 } // namespace AVX
69 } // namespace Vc
70 } // namespace AliRoot
71
72 #include "undomacros.h"
73
74 #endif // VC_AVX_CONST_DATA_H