cnfy-uint 0.2.3

Zero-dependency 256-bit unsigned integer arithmetic for cryptographic applications
Documentation
//! [`Default`] implementation for [`U512`], returning zero.
use super::U512;

/// Returns the zero value as the default for [`U512`].
///
/// All eight limbs are set to zero, consistent with the standard library
/// convention where numeric types default to zero.
///
/// # Examples
///
/// ```
/// use cnfy_uint::u512::U512;
///
/// let d: U512 = Default::default();
/// assert_eq!(d, U512::from_be_limbs([0; 8]));
/// ```
impl Default for U512 {
    #[inline]
    fn default() -> Self {
        Self([0; 8])
    }
}

#[cfg(test)]
mod ai_tests {
    use super::*;

    /// Default produces the zero value.
    #[test]
    fn default_is_zero() {
        assert_eq!(U512::default(), U512::from_be_limbs([0; 8]));
    }

    /// Default equals explicit zero construction.
    #[test]
    fn default_matches_explicit_zero() {
        assert_eq!(
            U512::default(),
            U512::from_be_limbs([0, 0, 0, 0, 0, 0, 0, 0])
        );
    }
}