#[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),*]) => {
($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)
Rem, rem, RemAssign, rem_assign;
}
-impl Float<u32> for F16 {
+impl Float for F16 {
type FloatEncoding = F16;
type BitsType = u16;
type SignedBitsType = i16;