mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-28 11:16:49 +03:00
fix: use a hand-written impl of get_index
Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
parent
670e3c0b47
commit
dee5f7dc15
@ -31,7 +31,7 @@ use snarkvm_gadgets::traits::utilities::{
|
||||
uint::{Sub as UIntSub, *},
|
||||
};
|
||||
use snarkvm_r1cs::{ConstraintSystem, SynthesisError};
|
||||
use std::fmt;
|
||||
use std::{convert::TryInto, fmt};
|
||||
|
||||
/// An integer type enum wrapping the integer value.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd)]
|
||||
@ -113,7 +113,7 @@ impl Integer {
|
||||
|
||||
pub fn to_usize(&self) -> Option<usize> {
|
||||
let unsigned_integer = self;
|
||||
match_unsigned_integer!(unsigned_integer => unsigned_integer.get_index())
|
||||
match_unsigned_integer!(unsigned_integer => unsigned_integer.value.map(|num| num.try_into().ok()).flatten())
|
||||
}
|
||||
|
||||
pub fn get_type(&self) -> IntegerType {
|
||||
|
Loading…
Reference in New Issue
Block a user