summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-10 11:16:24 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-11 14:50:02 -0500
commit90b4b08717730733402df25190bba0cc5d2fd952 (patch)
treefe85f6fa7d8128e6195a313f428fb3bf6b446929 /math.c
parent5bffb50207f8d8ba873f4c40dde4859179153001 (diff)
indent/dedent selection
Diffstat (limited to 'math.c')
-rw-r--r--math.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/math.c b/math.c
index 37e3e1b..b76c049 100644
--- a/math.c
+++ b/math.c
@@ -109,6 +109,15 @@ static inline u32 max_u32(u32 a, u32 b) {
return a > b ? a : b;
}
+// set *a to the minimum of *a and *b, and *b to the maximum
+static inline void sort2_u32(u32 *a, u32 *b) {
+ u32 x = *a, y = *b;
+ if (x > y) {
+ *a = y;
+ *b = x;
+ }
+}
+
static inline i32 min_i32(i32 a, i32 b) {
return a < b ? a : b;
}