diff --git a/noir_stdlib/src/uint128.nr b/noir_stdlib/src/uint128.nr index c87cae98b3..ffd6d60b6c 100644 --- a/noir_stdlib/src/uint128.nr +++ b/noir_stdlib/src/uint128.nr @@ -1,6 +1,6 @@ use crate::cmp::{Eq, Ord, Ordering}; use crate::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Not, Rem, Shl, Shr, Sub}; -use super::convert::AsPrimitive; +use super::{convert::AsPrimitive, default::Default}; global pow64: Field = 18446744073709551616; //2^64; global pow63: Field = 9223372036854775808; // 2^63; @@ -331,7 +331,14 @@ impl Shr for U128 { } } +impl Default for U128 { + fn default() -> Self { + U128::zero() + } +} + mod tests { + use crate::default::Default; use crate::ops::Not; use crate::uint128::{pow63, pow64, U128}; @@ -565,4 +572,9 @@ mod tests { ), ); } + + #[test] + fn test_default() { + assert_eq(U128::default(), U128::zero()); + } }