cnfy-uint 0.2.3

Zero-dependency 256-bit unsigned integer arithmetic for cryptographic applications
Documentation
//! Returns the six `u64` limbs in little-endian order.
use super::U384;

impl U384 {
    /// Returns the six `u64` limbs in little-endian order.
    ///
    /// Since the internal storage is already little-endian, this returns
    /// the raw limb array directly.
    ///
    /// # Examples
    ///
    /// ```
    /// use cnfy_uint::u384::U384;
    ///
    /// let v = U384::from_be_limbs([1, 2, 3, 4, 5, 6]);
    /// assert_eq!(v.to_le_limbs(), [6, 5, 4, 3, 2, 1]);
    /// ```
    #[inline]
    pub const fn to_le_limbs(&self) -> [u64; 6] {
        self.0
    }
}

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

    /// to_le_limbs reverses the big-endian order.
    #[test]
    fn le_limbs_reverses() {
        let v = U384::from_be_limbs([1, 2, 3, 4, 5, 6]);
        assert_eq!(v.to_le_limbs(), [6, 5, 4, 3, 2, 1]);
    }

    /// Zero in little-endian is still all zeros.
    #[test]
    fn le_limbs_zero() {
        assert_eq!(U384::from_be_limbs([0; 6]).to_le_limbs(), [0; 6]);
    }
}