Remove assert in Uint256::from_i64 and return None instead

This commit is contained in:
Steven Roose 2020-10-23 17:27:06 +01:00
parent 5c04a059d5
commit cc095a4ba7
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
1 changed files with 5 additions and 2 deletions

View File

@ -83,8 +83,11 @@ macro_rules! construct_uint {
/// Create an object from a given signed 64-bit integer
#[inline]
pub fn from_i64(init: i64) -> Option<$name> {
assert!(init >= 0);
if init >= 0 {
$name::from_u64(init as u64)
} else {
None
}
}
/// Creates big integer value from a byte slice array using