]> git.uio.no Git - u/mrichter/AliRoot.git/blob - Vc/include/Vc/avx/const_data.h
dadc89b726f2db36d408e27123e6b0daf7d8eb1b
[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 Vc
25 {
26 namespace AVX
27 {
28
29 ALIGN(64) extern const unsigned int   _IndexesFromZero32[8];
30 ALIGN(16) extern const unsigned short _IndexesFromZero16[8];
31 ALIGN(16) extern const unsigned char  _IndexesFromZero8[16];
32
33 struct STRUCT_ALIGN1(64) c_general
34 {
35     static const float oneFloat;
36     static const unsigned int absMaskFloat[2];
37     static const unsigned int signMaskFloat[2];
38     static const unsigned short minShort[2];
39     static const unsigned short one16[2];
40     static const float _2power31;
41     static const double oneDouble;
42     static const unsigned long long frexpMask;
43 } STRUCT_ALIGN2(64);
44
45 template<typename T> struct c_sin
46 {
47     ALIGN(64) static const T data[];
48 };
49
50 template<typename T> struct c_log
51 {
52     typedef float floatAlias MAY_ALIAS;
53     static inline float d(int i) { return *reinterpret_cast<const floatAlias *>(&data[i]); }
54     ALIGN(64) static const unsigned int data[];
55 };
56
57 template<> struct c_log<double>
58 {
59     enum VectorSize { Size = 16 / sizeof(double) };
60     typedef double doubleAlias MAY_ALIAS;
61     static inline double d(int i) { return *reinterpret_cast<const doubleAlias *>(&data[i]); }
62     ALIGN(64) static const unsigned long long data[];
63 };
64
65 } // namespace AVX
66 } // namespace Vc
67
68 #include "undomacros.h"
69
70 #endif // VC_AVX_CONST_DATA_H