Remove assert in Uint256::from_i64 and return None instead
This commit is contained in:
parent
5c04a059d5
commit
cc095a4ba7
|
@ -83,8 +83,11 @@ macro_rules! construct_uint {
|
||||||
/// Create an object from a given signed 64-bit integer
|
/// Create an object from a given signed 64-bit integer
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_i64(init: i64) -> Option<$name> {
|
pub fn from_i64(init: i64) -> Option<$name> {
|
||||||
assert!(init >= 0);
|
if init >= 0 {
|
||||||
$name::from_u64(init as u64)
|
$name::from_u64(init as u64)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates big integer value from a byte slice array using
|
/// Creates big integer value from a byte slice array using
|
||||||
|
|
Loading…
Reference in New Issue