From f31fad1b98eec865bc1199c5e4c98fd8422967c2 Mon Sep 17 00:00:00 2001 From: rexim Date: Mon, 19 Aug 2019 00:39:11 +0700 Subject: [PATCH] (#1010) Make extrema functions inlinable --- CMakeLists.txt | 1 - src/math/extrema.c | 12 ------------ src/math/extrema.h | 13 +++++++++++-- 3 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 src/math/extrema.c diff --git a/CMakeLists.txt b/CMakeLists.txt index e02487b5..d81f4238 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,6 @@ add_executable(nothing src/game/sprite_font.c src/game/sprite_font.h src/main.c - src/math/extrema.c src/math/extrema.h src/math/mat3x3.c src/math/mat3x3.h diff --git a/src/math/extrema.c b/src/math/extrema.c deleted file mode 100644 index e7b97c20..00000000 --- a/src/math/extrema.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "./extrema.h" - -int64_t max_int64(int64_t a, int64_t b) -{ - return a > b ? a : b; -} - -size_t max_size_t(size_t a, size_t b) -{ - return a > b ? a : b; -} diff --git a/src/math/extrema.h b/src/math/extrema.h index fb756440..f6189879 100644 --- a/src/math/extrema.h +++ b/src/math/extrema.h @@ -6,7 +6,16 @@ // WARNING! Any attempts to "generalize" or "improve" this translation // unit will result in an instantly closed Pull Request without any // further discussion. -int64_t max_int64(int64_t a, int64_t b); -size_t max_size_t(size_t a, size_t b); +static inline +int64_t max_int64(int64_t a, int64_t b) +{ + return a > b ? a : b; +} + +static inline +size_t max_size_t(size_t a, size_t b) +{ + return a > b ? a : b; +} #endif // EXTREMA_H_