diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-04-28 16:27:56 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-04-28 16:29:48 -0700 |
commit | 69b94a6eabdb5340e3ea0d2211fd588fce7fd761 (patch) | |
tree | e9b3061e1e05946d65779ed6a1aa7d1359b5f447 /src/libs/din | |
parent | 44aa595269516d44f6642890a9211bcdde8b29fd (diff) |
libs/din: minor optimization in clamp()
short-circuit by directly returning bound when exceeded
Diffstat (limited to 'src/libs/din')
-rw-r--r-- | src/libs/din/din.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/din/din.c b/src/libs/din/din.c index 44c6ec8..22e2848 100644 --- a/src/libs/din/din.c +++ b/src/libs/din/din.c @@ -92,10 +92,10 @@ static inline float lerp(float a, float b, float t) static inline float clamp(float x, float lowerlimit, float upperlimit) { if (x < lowerlimit) - x = lowerlimit; + return lowerlimit; if (x > upperlimit) - x = upperlimit; + return upperlimit; return x; } |