Automatic Differentiation
 
Loading...
Searching...
No Matches
compiler_attributes.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_META_COMPILER_ATTRIBUTES_HPP
2#define STAN_MATH_PRIM_META_COMPILER_ATTRIBUTES_HPP
3
4#ifdef __GNUC__
5#ifndef likely
6#define likely(x) __builtin_expect(!!(x), 1)
7#endif
8#ifndef unlikely
9#define unlikely(x) __builtin_expect(!!(x), 0)
10#endif
11#ifdef __has_attribute
12#if __has_attribute(noinline) && __has_attribute(cold)
13#ifndef STAN_COLD_PATH
19#define STAN_COLD_PATH __attribute__((noinline, cold))
20#endif
21#endif
22#endif
23#endif
24#ifndef STAN_COLD_PATH
25#define STAN_COLD_PATH
26#endif
27#ifndef likely
28#define likely(x) x
29#endif
30#ifndef unlikely
31#define unlikely(x) x
32#endif
33
37#ifndef STAN_NO_RANGE_CHECKS_RETURN
41#ifdef STAN_NO_RANGE_CHECKS
42#define STAN_NO_RANGE_CHECKS_RETURN return
43#endif
44#ifndef STAN_NO_RANGE_CHECKS_RETURN
45#define STAN_NO_RANGE_CHECKS_RETURN
46#endif
47#endif
48
49#endif