aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2024-01-16 21:16:37 +0100
committerkdx <kikoodx@paranoici.org>2024-01-16 21:18:04 +0100
commitd1503291d0fc33ca3a18e63bb548796567b8e9b5 (patch)
tree0dd77cd76a0e50c4f4dcc656e1b9d9fec293856f
parentaf2baacc0ccd6fc3ebd58b4e314f8bc80361c416 (diff)
downloadcminus-d1503291d0fc33ca3a18e63bb548796567b8e9b5.tar.gz
appr
-rw-r--r--_.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/_.h b/_.h
index 5ea9f60..4e8eb40 100644
--- a/_.h
+++ b/_.h
@@ -55,6 +55,12 @@ void *_realloc(void *ptr, size_t size);
const auto ___y = (Y); \
(___x < ___y) ? ___x : ___y; \
})
+#define appr(X, Y, S) ({ \
+ const auto __x_ = (X); \
+ const auto __y_ = (Y); \
+ const auto __s_ = (S); \
+ (__x_ > __y_) ? max(__x_ - __s_, __y_) : min(__x_ + __s_, __y_); \
+})
#define STR(X) #X
#define defer(X) if (atexit(X)) { X(); panic("defer"); }