summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
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;
}