summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-01-18 19:35:08 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-01-18 19:35:29 +0100
commitd361f57c8064ce13a0478653050b169dc94e2e99 (patch)
tree73613b75bc4e6533455b6c3ad79c3fa39b8554fb /compat
parent2ab18fd01bc7c46043429511a3801846b998c749 (diff)
compat/util: retire
Adjust usages.
Diffstat (limited to 'compat')
-rw-r--r--compat/check-visible.hpp2
-rw-r--r--compat/correlation-calibrator.cpp2
-rw-r--r--compat/library-path.hpp4
-rw-r--r--compat/macros.hpp4
-rw-r--r--compat/math-imports.hpp8
-rw-r--r--compat/math.hpp (renamed from compat/clamp.hpp)24
-rw-r--r--compat/meta.hpp5
-rw-r--r--compat/round.hpp15
-rw-r--r--compat/timer.hpp8
-rw-r--r--compat/util.hpp10
10 files changed, 38 insertions, 44 deletions
diff --git a/compat/check-visible.hpp b/compat/check-visible.hpp
index f5420a39..a0211982 100644
--- a/compat/check-visible.hpp
+++ b/compat/check-visible.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "export.hpp"
-#include "util.hpp"
+#include "macros.hpp"
#include <QWidget>
diff --git a/compat/correlation-calibrator.cpp b/compat/correlation-calibrator.cpp
index 1d3339d3..aef804d2 100644
--- a/compat/correlation-calibrator.cpp
+++ b/compat/correlation-calibrator.cpp
@@ -1,6 +1,6 @@
#include "correlation-calibrator.hpp"
#include "variance.hpp"
-#include "util.hpp"
+#include "compat/math.hpp"
#include <cmath>
#include <iterator>
diff --git a/compat/library-path.hpp b/compat/library-path.hpp
new file mode 100644
index 00000000..e14cf5e0
--- /dev/null
+++ b/compat/library-path.hpp
@@ -0,0 +1,4 @@
+#pragma once
+
+// from build directory
+#include "__opentrack-library-path.h"
diff --git a/compat/macros.hpp b/compat/macros.hpp
index d51bace7..766730db 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -71,7 +71,3 @@
# define unlikely(x) (x)
#endif
-#define progn(...) (([&]() { __VA_ARGS__ })())
-#define prog1(x, ...) (([&]() { auto _ret1324 = (x); do { __VA_ARGS__; } while (0); return _ret1324; })())
-
-#define once_only(...) do { static bool once__ = false; if (!once__) { once__ = true; __VA_ARGS__; } } while(false)
diff --git a/compat/math-imports.hpp b/compat/math-imports.hpp
index 4d8d5a5f..67b7e6ed 100644
--- a/compat/math-imports.hpp
+++ b/compat/math-imports.hpp
@@ -1,11 +1,5 @@
#pragma once
-template <typename T>
-static inline constexpr auto signum(T x)
-{
- return x < T(0) ? -1 : 1;
-}
-
#include <cmath>
using std::copysign;
@@ -51,3 +45,5 @@ using std::uint8_t;
using std::min;
using std::max;
+
+#include "math.hpp"
diff --git a/compat/clamp.hpp b/compat/math.hpp
index 8141e25f..5d80dace 100644
--- a/compat/clamp.hpp
+++ b/compat/math.hpp
@@ -1,10 +1,10 @@
#pragma once
+#include "macros.hpp"
+
#include <cmath>
#include <type_traits>
-#include "macros.hpp"
-
namespace util_detail {
template<typename n>
@@ -52,3 +52,23 @@ inline auto clamp(const t& val, const u& min, const w& max)
using tp = decltype(val + min + max);
return ::util_detail::clamp<std::decay_t<tp>, tp>::clamp_(val, min, max);
}
+
+template<typename t>
+inline int iround(const t& val)
+{
+ return int(std::round(val));
+}
+
+template<typename t>
+inline unsigned uround(const t& val)
+{
+ return std::round(std::fmax(t(0), val));
+}
+
+#include "macros.hpp"
+
+template <typename T>
+static force_inline constexpr auto signum(T x)
+{
+ return x < T(0) ? -1 : 1;
+}
diff --git a/compat/meta.hpp b/compat/meta.hpp
index ce81b3d0..80eca89a 100644
--- a/compat/meta.hpp
+++ b/compat/meta.hpp
@@ -12,6 +12,11 @@
template<typename t>
using cv_qualified = std::conditional_t<std::is_fundamental_v<std::decay_t<t>>, std::decay_t<t>, const t&>;
+#define progn(...) (([&]() { __VA_ARGS__ })())
+#define prog1(x, ...) (([&]() { auto _ret1324 = (x); do { __VA_ARGS__; } while (0); return _ret1324; })())
+
+#define once_only(...) do { static bool once__ = false; if (!once__) { once__ = true; __VA_ARGS__; } } while(false)
+
#if 0
#include <tuple>
diff --git a/compat/round.hpp b/compat/round.hpp
deleted file mode 100644
index 90a0ccb3..00000000
--- a/compat/round.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#include <cmath>
-
-template<typename t>
-inline int iround(const t& val)
-{
- return int(std::round(val));
-}
-
-template<typename t>
-inline unsigned uround(const t& val)
-{
- return std::round(std::fmax(t(0), val));
-}
diff --git a/compat/timer.hpp b/compat/timer.hpp
index ac255a9d..a92d3f68 100644
--- a/compat/timer.hpp
+++ b/compat/timer.hpp
@@ -9,6 +9,9 @@
#pragma once
#include "export.hpp"
+#include "time.hpp"
+
+#include <ctime>
#if defined (_WIN32)
# include <windows.h>
@@ -17,11 +20,6 @@
# include <mach/mach_time.h>
#endif
-#include <ctime>
-
-#include "time.hpp"
-#include "util.hpp"
-
class OTR_COMPAT_EXPORT Timer final
{
struct timespec state;
diff --git a/compat/util.hpp b/compat/util.hpp
deleted file mode 100644
index dda947e5..00000000
--- a/compat/util.hpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#pragma once
-
-#include "opentrack-library-path.h"
-#include "run-in-thread.hpp"
-#include "meta.hpp"
-#include "macros.hpp"
-#include "round.hpp"
-#include "clamp.hpp"
-
-#include <QDebug>