diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2022-05-08 02:05:03 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-09 21:49:48 +0200 |
commit | 2c381ea45ceda34bf478301976129fe1e24af074 (patch) | |
tree | ca98771ac29b8e49a7f7d17f9c71ff1ef0b08a08 /AK | |
parent | 7906ada01547d13932fdfc63cc4c7cb7cc3560fb (diff) | |
download | serenity-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.h | 5 |
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 |