1 ////////////////////////////////////////////////////////////////
2 //
3 //  opthelper.h includes some #defines which help to make optimizations easier and better readable
4 //
5 //  copyright (c) 2013  Ingo Weyrich
6 //
7 //  this is free software: you can redistribute it and/or modify
8 //  it under the terms of the GNU General Public License as published by
9 //  the Free Software Foundation, either version 3 of the License, or
10 //  (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 //
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program.  If not, see <https://www.gnu.org/licenses/>.
19 //
20 ////////////////////////////////////////////////////////////////
21 
22 #ifndef OPTHELPER_H
23     #define OPTHELPER_H
24 
25     #define pow_F(a,b) (xexpf(b*xlogf(a)))
26 
27     #ifdef __SSE2__
28         #include "sleefsseavx.c"
29     #endif
30 
31     #ifdef __GNUC__
32         #define RESTRICT    __restrict__
33         #define LIKELY(x)   __builtin_expect (!!(x), 1)
34         #define UNLIKELY(x) __builtin_expect (!!(x), 0)
35         #define ALIGNED64 __attribute__ ((aligned (64)))
36         #define ALIGNED16 __attribute__ ((aligned (16)))
37     #else
38         #define RESTRICT
39         #define LIKELY(x)    (x)
40         #define UNLIKELY(x)  (x)
41         #define ALIGNED64
42         #define ALIGNED16
43     #endif
44 #endif
45