AK: Add clamp(f32x4, float, float)

We are allowed to directly compare `f32x4` with a `float`, so make use
of it.
This commit is contained in:
Jelle Raaijmakers 2022-05-08 02:05:03 +02:00 committed by Linus Groh
parent 7906ada015
commit 2c381ea45c

View file

@ -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