1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! [`Default`] implementation for [`U320`], returning zero.
use super::U320;
/// Returns the zero value as the default for [`U320`].
///
/// All five limbs are set to zero, consistent with the standard library
/// convention where numeric types default to zero.
///
/// # Examples
///
/// ```
/// use cnfy_uint::u320::U320;
///
/// let d: U320 = Default::default();
/// assert_eq!(d, U320::from_be_limbs([0; 5]));
/// ```
impl Default for U320 {
#[inline]
fn default() -> Self {
Self([0; 5])
}
}
#[cfg(test)]
mod ai_tests {
use super::*;
/// Default produces the zero value.
#[test]
fn default_is_zero() {
assert_eq!(U320::default(), U320::from_be_limbs([0; 5]));
}
/// Default equals explicit zero construction.
#[test]
fn default_matches_explicit_zero() {
assert_eq!(U320::default(), U320::from_be_limbs([0, 0, 0, 0, 0]));
}
}