fix: use a hand-written impl of get_index

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz 2021-04-01 13:23:48 +02:00
parent 670e3c0b47
commit dee5f7dc15

View File

@ -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 {