From 6961943ed875f197134a346a137238bd0fc228c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 26 May 2015 09:20:27 -0700 Subject: [PATCH] Added uint32_iclamp. --- include/bx/uint32_t.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/bx/uint32_t.h b/include/bx/uint32_t.h index f4637b4..48908f6 100644 --- a/include/bx/uint32_t.h +++ b/include/bx/uint32_t.h @@ -276,6 +276,14 @@ namespace bx return result; } + inline uint32_t uint32_iclamp(uint32_t _a, uint32_t _min, uint32_t _max) + { + const uint32_t tmp = uint32_imax(_a, _min); + const uint32_t result = uint32_imin(tmp, _max); + + return result; + } + inline uint32_t uint32_incwrap(uint32_t _val, uint32_t _min, uint32_t _max) { const uint32_t inc = uint32_inc(_val);