summaryrefslogtreecommitdiffstats
path: root/src/core/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/common.h')
-rw-r--r--src/core/common.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/common.h b/src/core/common.h
index da162762..0d0528b1 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -11,6 +11,10 @@
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
#endif
+#ifdef __SWITCH__
+#include <switch.h>
+#endif
+
#include <stdint.h>
#include <string.h>
#include <math.h>
@@ -292,6 +296,8 @@ extern wchar *AllocUnicode(const char*src);
#define Clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
+#define Clamp2(v, center, radius) ((v) > (center) ? Min(v, center + radius) : Max(v, center - radius))
+
inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x))