stdsimd bindings work!
[vector-math.git] / src / f16.rs
index ee13d9992135320be52859df3d5c51f6482ff933..5bc1119443466e949640876b70e54c6bf15f24d6 100644 (file)
@@ -14,6 +14,12 @@ type F16Impl = u16;
 #[repr(transparent)]
 pub struct F16(F16Impl);
 
 #[repr(transparent)]
 pub struct F16(F16Impl);
 
+#[cfg(not(feature = "f16"))]
+#[track_caller]
+pub(crate) fn panic_f16_feature_disabled() -> ! {
+    panic!("f16 feature is not enabled")
+}
+
 #[cfg(feature = "f16")]
 macro_rules! f16_impl {
     ($v:expr, [$($vars:ident),*]) => {
 #[cfg(feature = "f16")]
 macro_rules! f16_impl {
     ($v:expr, [$($vars:ident),*]) => {
@@ -26,11 +32,17 @@ macro_rules! f16_impl {
     ($v:expr, [$($vars:ident),*]) => {
         {
             $(let _ = $vars;)*
     ($v:expr, [$($vars:ident),*]) => {
         {
             $(let _ = $vars;)*
-            panic!("f16 feature is not enabled")
+            panic_f16_feature_disabled()
         }
     };
 }
 
         }
     };
 }
 
+impl Default for F16 {
+    fn default() -> Self {
+        f16_impl!(F16(F16Impl::default()), [])
+    }
+}
+
 impl From<F16Impl> for F16 {
     fn from(v: F16Impl) -> Self {
         F16(v)
 impl From<F16Impl> for F16 {
     fn from(v: F16Impl) -> Self {
         F16(v)