summaryrefslogtreecommitdiffstats
path: root/src/core/common.h
diff options
context:
space:
mode:
authormajestic <majesticcoding@gmail.com>2020-09-30 12:13:32 +0200
committermajestic <majesticcoding@gmail.com>2020-09-30 12:13:32 +0200
commitd4efd003bc614f20074dd4daf96a2a223ff51bea (patch)
treecde4b80f479c84fe4a164fe3daef1309785f17be /src/core/common.h
parentExperiment (diff)
parentMerge remote-tracking branch 'origin/master' into miami (diff)
downloadre3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar
re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.gz
re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.bz2
re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.lz
re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.xz
re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.zst
re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.zip
Diffstat (limited to 'src/core/common.h')
-rw-r--r--src/core/common.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/common.h b/src/core/common.h
index ba1d24ef..0a2a236e 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -219,6 +219,8 @@ extern int strncasecmp(const char *str1, const char *str2, size_t len);
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
+#define clamp2(v, center, radius) ((v) < (center) ? Max(v, center - radius) : Min(v, center + radius))
+
inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x))