summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/linkage-macros.hpp3
-rw-r--r--compat/math-imports.hpp45
2 files changed, 48 insertions, 0 deletions
diff --git a/compat/linkage-macros.hpp b/compat/linkage-macros.hpp
index 460e7ee5..a4c4b351 100644
--- a/compat/linkage-macros.hpp
+++ b/compat/linkage-macros.hpp
@@ -7,3 +7,6 @@
# define OTR_GENERIC_EXPORT __attribute__ ((visibility ("default")))
# define OTR_GENERIC_IMPORT
#endif
+
+#define OTR_TEMPLATE_EXPORT template class OTR_GENERIC_EXPORT
+#define OTR_TEMPLATE_IMPORT extern template class OTR_GENERIC_IMPORT
diff --git a/compat/math-imports.hpp b/compat/math-imports.hpp
new file mode 100644
index 00000000..ad70f361
--- /dev/null
+++ b/compat/math-imports.hpp
@@ -0,0 +1,45 @@
+#pragma once
+
+#include <cmath>
+#include <cinttypes>
+
+namespace otr_math
+{
+
+using std::copysign;
+
+using std::sqrt;
+using std::pow;
+
+using std::fabs;
+using std::fmin;
+using std::fmax;
+
+using std::atan;
+using std::atan2;
+using std::asin;
+using std::acos;
+
+using std::sin;
+using std::cos;
+using std::tan;
+
+using std::round;
+using std::fmod;
+
+using std::uintptr_t;
+using std::intptr_t;
+
+using std::int64_t;
+using std::int32_t;
+
+using std::uint64_t;
+using std::uint32_t;
+
+template <typename T>
+static inline constexpr auto signum(T x)
+{
+ return (T() < x) - (x < T());
+}
+
+} // ns otr_math