mirror of
https://github.com/BlackMATov/vmath.hpp.git
synced 2025-12-13 20:17:58 +07:00
remove fma functions
This commit is contained in:
@@ -1006,9 +1006,6 @@ T step(T edge, T x);
|
|||||||
|
|
||||||
template < floating_point T >
|
template < floating_point T >
|
||||||
T smoothstep(T edge0, T edge1, T x);
|
T smoothstep(T edge0, T edge1, T x);
|
||||||
|
|
||||||
template < floating_point T >
|
|
||||||
T fma(T x, T y, T z);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Vector
|
#### Vector
|
||||||
@@ -1112,9 +1109,6 @@ vec<T, Size> smoothstep(T edge0, T edge1, const vec<T, Size>& xs);
|
|||||||
|
|
||||||
template < typename T, size_t Size >
|
template < typename T, size_t Size >
|
||||||
vec<T, Size> smoothstep(const vec<T, Size>& edges0, const vec<T, Size>& edges1, const vec<T, Size>& xs);
|
vec<T, Size> smoothstep(const vec<T, Size>& edges0, const vec<T, Size>& edges1, const vec<T, Size>& xs);
|
||||||
|
|
||||||
template < typename T, size_t Size >
|
|
||||||
vec<T, Size> fma(const vec<T, Size>& as, const vec<T, Size>& bs, const vec<T, Size>& cs);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Quaternion
|
#### Quaternion
|
||||||
|
|||||||
@@ -138,12 +138,6 @@ namespace vmath_hpp
|
|||||||
const T t = clamp((x - edge0) * rcp(edge1 - edge0), T{0}, T{1});
|
const T t = clamp((x - edge0) * rcp(edge1 - edge0), T{0}, T{1});
|
||||||
return t * t * (T{3} - T{2} * t);
|
return t * t * (T{3} - T{2} * t);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < typename T >
|
|
||||||
[[nodiscard]] std::enable_if_t<std::is_floating_point_v<T>, T>
|
|
||||||
fma(T x, T y, T z) noexcept {
|
|
||||||
return std::fma(x, y, z);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -632,11 +632,6 @@ namespace vmath_hpp
|
|||||||
[[nodiscard]] constexpr vec<T, Size> smoothstep(const vec<T, Size>& edges0, const vec<T, Size>& edges1, const vec<T, Size>& xs) {
|
[[nodiscard]] constexpr vec<T, Size> smoothstep(const vec<T, Size>& edges0, const vec<T, Size>& edges1, const vec<T, Size>& xs) {
|
||||||
return map_join([](T edge0, T edge1, T x) { return smoothstep(edge0, edge1, x); }, edges0, edges1, xs);
|
return map_join([](T edge0, T edge1, T x) { return smoothstep(edge0, edge1, x); }, edges0, edges1, xs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template < typename T, std::size_t Size >
|
|
||||||
[[nodiscard]] constexpr vec<T, Size> fma(const vec<T, Size>& as, const vec<T, Size>& bs, const vec<T, Size>& cs) {
|
|
||||||
return map_join([](T a, T b, T c) { return fma(a, b, c); }, as, bs, cs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ namespace
|
|||||||
constexpr friend fix step(const fix& e, const fix& l) { using vmath_hpp::step; return fix{step(e.underlying(), l.underlying())}; }
|
constexpr friend fix step(const fix& e, const fix& l) { using vmath_hpp::step; return fix{step(e.underlying(), l.underlying())}; }
|
||||||
constexpr friend fix smoothstep(const fix& e0, const fix& e1, const fix& l) { using vmath_hpp::smoothstep; return fix{smoothstep(e0.underlying(), e1.underlying(), l.underlying())}; }
|
constexpr friend fix smoothstep(const fix& e0, const fix& e1, const fix& l) { using vmath_hpp::smoothstep; return fix{smoothstep(e0.underlying(), e1.underlying(), l.underlying())}; }
|
||||||
|
|
||||||
constexpr friend fix fma(const fix& x, const fix& y, const fix& z) { using vmath_hpp::fma; return fix{fma(x.underlying(), y.underlying(), z.underlying())}; }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
constexpr friend fix<bool> any(const fix& l) { using vmath_hpp::any; return fix<bool>{any(l.underlying())}; }
|
constexpr friend fix<bool> any(const fix& l) { using vmath_hpp::any; return fix<bool>{any(l.underlying())}; }
|
||||||
@@ -199,8 +197,6 @@ namespace vmath_hpp
|
|||||||
template fix2f step(const fix2f&, const fix2f&);
|
template fix2f step(const fix2f&, const fix2f&);
|
||||||
template fix2f smoothstep(fix<float>, fix<float>, const fix2f&);
|
template fix2f smoothstep(fix<float>, fix<float>, const fix2f&);
|
||||||
template fix2f smoothstep(const fix2f&, const fix2f&, const fix2f&);
|
template fix2f smoothstep(const fix2f&, const fix2f&, const fix2f&);
|
||||||
|
|
||||||
template fix2f fma(const fix2f&, const fix2f&, const fix2f&);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace vmath_hpp
|
namespace vmath_hpp
|
||||||
|
|||||||
@@ -105,8 +105,6 @@ TEST_CASE("vmath/fun") {
|
|||||||
STATIC_CHECK(step(0.5f, 0.4f) == uapprox(0.f));
|
STATIC_CHECK(step(0.5f, 0.4f) == uapprox(0.f));
|
||||||
STATIC_CHECK(step(0.5f, 0.6f) == uapprox(1.f));
|
STATIC_CHECK(step(0.5f, 0.6f) == uapprox(1.f));
|
||||||
STATIC_CHECK(smoothstep(0.f, 1.f, 0.1f) == uapprox(0.028f));
|
STATIC_CHECK(smoothstep(0.f, 1.f, 0.1f) == uapprox(0.028f));
|
||||||
|
|
||||||
CHECK(fma(2.f, 3.f, 4.f) == uapprox(10.f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("Geometric Functions") {
|
SUBCASE("Geometric Functions") {
|
||||||
|
|||||||
@@ -249,8 +249,6 @@ TEST_CASE("vmath/vec_fun") {
|
|||||||
|
|
||||||
STATIC_CHECK(smoothstep(0.f, 1.f, float2(0.1f)) == uapprox2(0.028f));
|
STATIC_CHECK(smoothstep(0.f, 1.f, float2(0.1f)) == uapprox2(0.028f));
|
||||||
STATIC_CHECK(smoothstep(float2(0.f), float2(1.f), float2(0.1f)) == uapprox2(0.028f));
|
STATIC_CHECK(smoothstep(float2(0.f), float2(1.f), float2(0.1f)) == uapprox2(0.028f));
|
||||||
|
|
||||||
CHECK_FALSE(fma(float2(2.f), float2(3.f), float2(4.f)).x == uapprox(12.f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBCASE("Geometric Functions") {
|
SUBCASE("Geometric Functions") {
|
||||||
|
|||||||
Reference in New Issue
Block a user