summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2022-05-08 02:05:03 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-09 21:49:48 +0200
commit2c381ea45ceda34bf478301976129fe1e24af074 (patch)
treeca98771ac29b8e49a7f7d17f9c71ff1ef0b08a08 /AK
parent7906ada01547d13932fdfc63cc4c7cb7cc3560fb (diff)
downloadserenity-2c381ea45ceda34bf478301976129fe1e24af074.zip
AK: Add `clamp(f32x4, float, float)`
We are allowed to directly compare `f32x4` with a `float`, so make use of it.
Diffstat (limited to 'AK')
-rw-r--r--AK/SIMDMath.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/AK/SIMDMath.h b/AK/SIMDMath.h
index 5fff5c361d..4032ceabf1 100644
--- a/AK/SIMDMath.h
+++ b/AK/SIMDMath.h
@@ -52,6 +52,11 @@ ALWAYS_INLINE static f32x4 clamp(f32x4 v, f32x4 min, f32x4 max)
return v < min ? min : (v > max ? max : v);
}
+ALWAYS_INLINE static f32x4 clamp(f32x4 v, float min, float max)
+{
+ return v < min ? min : (v > max ? max : v);
+}
+
ALWAYS_INLINE static f32x4 exp(f32x4 v)
{
// FIXME: This should be replaced with a vectorized algorithm instead of calling the scalar expf 4 times