From a002576056e26673f0141e46786f44f0b9c90b70 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Sat, 24 Aug 2024 01:48:09 -0500 Subject: core: add a header for utility functions Add a header for dumping utility functions that are commonly used across several files. This header should only contain small, inline-able functions of no more than 5-10 lines of code. Signed-off-by: Danny Holman --- include/rune_util.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 include/rune_util.h diff --git a/include/rune_util.h b/include/rune_util.h new file mode 100644 index 0000000..f0613c9 --- /dev/null +++ b/include/rune_util.h @@ -0,0 +1,11 @@ +#ifndef RUNE_UTIL_H +#define RUNE_UTIL_H + +#include + +static inline uint32_t clamp(uint32_t value, float min, float max) { + const uint32_t ret = value < min ? min : value; + return ret > max ? max : ret; +} + +#endif -- cgit v1.2.3