add sin_pi_f16, cos_pi_f16, and sin_cos_pi_f16
[vector-math.git] / src / ir.rs
index a31bece004894b45b290738fd954b96009f070fc..e2b4a0ecd72cb58421cf07b060a023e3ef640020 100644 (file)
--- a/src/ir.rs
+++ b/src/ir.rs
@@ -1,6 +1,8 @@
 use crate::{
     f16::F16,
-    traits::{Bool, Compare, Context, ConvertTo, Float, Int, Make, SInt, Select, UInt},
+    traits::{
+        Bool, Compare, Context, ConvertFrom, ConvertTo, Float, Int, Make, SInt, Select, UInt,
+    },
 };
 use std::{
     borrow::Borrow,
@@ -1489,38 +1491,38 @@ ir_value!(
     }
 );
 
-macro_rules! impl_convert_to {
+macro_rules! impl_convert_from {
     ($src:ident -> $dest:ident) => {
-        impl<'ctx> ConvertTo<$dest<'ctx>> for $src<'ctx> {
-            fn to(self) -> $dest<'ctx> {
+        impl<'ctx> ConvertFrom<$src<'ctx>> for $dest<'ctx> {
+            fn cvt_from(v: $src<'ctx>) -> Self {
                 let value = if $src::TYPE == $dest::TYPE {
-                    self.value
+                    v.value
                 } else {
-                    self
+                    v
                         .ctx
-                        .make_operation(Opcode::Cast, [self.value], $dest::TYPE)
+                        .make_operation(Opcode::Cast, [v.value], $dest::TYPE)
                         .into()
                 };
                 $dest {
                     value,
-                    ctx: self.ctx,
+                    ctx: v.ctx,
                 }
             }
         }
     };
     ($first:ident $(, $ty:ident)*) => {
         $(
-            impl_convert_to!($first -> $ty);
-            impl_convert_to!($ty -> $first);
+            impl_convert_from!($first -> $ty);
+            impl_convert_from!($ty -> $first);
         )*
-        impl_convert_to![$($ty),*];
+        impl_convert_from![$($ty),*];
     };
     () => {
     };
 }
-impl_convert_to![IrU8, IrI8, IrU16, IrI16, IrF16, IrU32, IrI32, IrU64, IrI64, IrF32, IrF64];
+impl_convert_from![IrU8, IrI8, IrU16, IrI16, IrF16, IrU32, IrI32, IrU64, IrI64, IrF32, IrF64];
 
-impl_convert_to![
+impl_convert_from![
     IrVecU8, IrVecI8, IrVecU16, IrVecI16, IrVecF16, IrVecU32, IrVecI32, IrVecU64, IrVecI64,
     IrVecF32, IrVecF64
 ];