fast image operations
Diffstat (limited to 'src/math.rs')
-rw-r--r--src/math.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/math.rs b/src/math.rs
index 6ff5572..08e8457 100644
--- a/src/math.rs
+++ b/src/math.rs
@@ -8,3 +8,15 @@ pub fn madd(a: f32, b: f32, c: f32) -> f32 {
a * b + c
}
}
+
+/// helps
+pub trait FExt {
+ /// Calculates `a * b + c`, with hardware support if possible.
+ fn madd(self, a: f32, b: f32) -> Self;
+}
+
+impl FExt for f32 {
+ fn madd(self, a: f32, b: f32) -> Self {
+ madd(self, a, b)
+ }
+}