pub( crate ) mod private
{
use crate::*;
pub trait NanLikeInterface
{
fn make_nan_like() -> Self;
fn is_nan( &self ) -> bool;
}
macro_rules! impl_nan_like_for_integer
{
(
$( $Args : tt )*
) =>
{
impl NanLikeInterface for $( $Args )*
{
#[ inline ]
fn make_nan_like() -> Self
{
0
}
#[ inline ]
fn is_nan( &self ) -> bool
{
false
}
}
};
}
macro_rules! impl_nan_like_for_float
{
(
$( $Args : tt )*
) =>
{
impl NanLikeInterface for $( $Args )*
{
#[ inline ]
fn make_nan_like() -> Self
{
< $( $Args )* >::NAN
}
#[ inline ]
fn is_nan( &self ) -> bool
{
*self == < $( $Args )* >::NAN
}
}
};
}
for_each_int!( impl_nan_like_for_integer );
for_each_float!( impl_nan_like_for_float );
}
crate::mod_interface!
{
prelude use NanLikeInterface;
}