Define the CoreAudio default name only when needed
[openal-soft.git] / common / alnumbers.h
blob37a5541003b97ae2bf4a1269a64288030dd0fe77
1 #ifndef COMMON_ALNUMBERS_H
2 #define COMMON_ALNUMBERS_H
4 #include <utility>
6 namespace al {
8 namespace numbers {
10 namespace detail_ {
11 template<typename T>
12 using as_fp = std::enable_if_t<std::is_floating_point<T>::value, T>;
13 } // detail_
15 template<typename T>
16 static constexpr auto pi_v = detail_::as_fp<T>(3.141592653589793238462643383279502884L);
18 template<typename T>
19 static constexpr auto inv_pi_v = detail_::as_fp<T>(0.318309886183790671537767526745028724L);
21 template<typename T>
22 static constexpr auto sqrt2_v = detail_::as_fp<T>(1.414213562373095048801688724209698079L);
24 template<typename T>
25 static constexpr auto sqrt3_v = detail_::as_fp<T>(1.732050807568877293527446341505872367L);
27 static constexpr auto pi = pi_v<double>;
28 static constexpr auto inv_pi = inv_pi_v<double>;
29 static constexpr auto sqrt2 = sqrt2_v<double>;
30 static constexpr auto sqrt3 = sqrt3_v<double>;
32 } // namespace numbers
34 } // namespace al
36 #endif /* COMMON_ALNUMBERS_H */