From 34c2d24bf14be0da1db8088f65c44ac9228b796e Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 11 Mar 2021 16:46:29 -0800 Subject: [PATCH] remove old comparator files --- gadgets/src/bits/comparator.rs | 93 ---------------------------------- gadgets/src/bits/mod.rs | 3 -- 2 files changed, 96 deletions(-) delete mode 100644 gadgets/src/bits/comparator.rs diff --git a/gadgets/src/bits/comparator.rs b/gadgets/src/bits/comparator.rs deleted file mode 100644 index 40cbec43b0..0000000000 --- a/gadgets/src/bits/comparator.rs +++ /dev/null @@ -1,93 +0,0 @@ -// // Copyright (C) 2019-2021 Aleo Systems Inc. -// // This file is part of the Leo library. -// -// // The Leo library is free software: you can redistribute it and/or modify -// // it under the terms of the GNU General Public License as published by -// // the Free Software Foundation, either version 3 of the License, or -// // (at your option) any later version. -// -// // The Leo library is distributed in the hope that it will be useful, -// // but WITHOUT ANY WARRANTY; without even the implied warranty of -// // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// // GNU General Public License for more details. -// -// // You should have received a copy of the GNU General Public License -// // along with the Leo library. If not, see . -// -// use snarkvm_fields::{Field, PrimeField}; -// use snarkvm_gadgets::traits::utilities::{ -// boolean::Boolean, -// select::CondSelectGadget, -// uint::{UInt128, UInt16, UInt32, UInt64, UInt8}, -// }; -// use snarkvm_r1cs::{ConstraintSystem, SynthesisError}; -// -// pub trait EvaluateLtGadget { -// fn less_than>(&self, cs: CS, other: &Self) -> Result; -// } -// -// // implementing `EvaluateLtGadget` will implement `ComparatorGadget` -// pub trait ComparatorGadget -// where -// Self: EvaluateLtGadget, -// { -// fn greater_than>(&self, cs: CS, other: &Self) -> Result { -// other.less_than(cs, self) -// } -// -// fn less_than_or_equal>(&self, cs: CS, other: &Self) -> Result { -// let is_gt = self.greater_than(cs, other)?; -// Ok(is_gt.not()) -// } -// -// fn greater_than_or_equal>(&self, cs: CS, other: &Self) -> Result { -// other.less_than_or_equal(cs, self) -// } -// } -// -// macro_rules! uint_cmp_impl { -// ($($gadget: ident),*) => ($( -// /* Bitwise less than comparison of two unsigned integers */ -// impl EvaluateLtGadget for $gadget { -// fn less_than>(&self, mut cs: CS, other: &Self) -> Result { -// -// let mut result = Boolean::constant(true); -// let mut all_equal = Boolean::constant(true); -// -// // msb -> lsb -// for (i, (a, b)) in self -// .bits -// .iter() -// .rev() -// .zip(other.bits.iter().rev()) -// .enumerate() -// { -// // a == 0 & b == 1 -// let less = Boolean::and(cs.ns(|| format!("not a and b [{}]", i)), &a.not(), b)?; -// -// // a == b = !(a ^ b) -// let not_equal = Boolean::xor(cs.ns(|| format!("a XOR b [{}]", i)), a, b)?; -// let equal = not_equal.not(); -// -// // evaluate a <= b -// let less_or_equal = Boolean::or(cs.ns(|| format!("less or equal [{}]", i)), &less, &equal)?; -// -// // select the current result if it is the first bit difference -// result = Boolean::conditionally_select(cs.ns(|| format!("select bit [{}]", i)), &all_equal, &less_or_equal, &result)?; -// -// // keep track of equal bits -// all_equal = Boolean::and(cs.ns(|| format!("accumulate equal [{}]", i)), &all_equal, &equal)?; -// } -// -// result = Boolean::and(cs.ns(|| format!("false if all equal")), &result, &all_equal.not())?; -// -// Ok(result) -// } -// } -// -// /* Bitwise comparison of two unsigned integers */ -// impl ComparatorGadget for $gadget {} -// )*) -// } -// -// uint_cmp_impl!(UInt8, UInt16, UInt32, UInt64, UInt128); diff --git a/gadgets/src/bits/mod.rs b/gadgets/src/bits/mod.rs index 19d137f833..664a5d31b9 100644 --- a/gadgets/src/bits/mod.rs +++ b/gadgets/src/bits/mod.rs @@ -18,9 +18,6 @@ pub mod adder; pub use self::adder::*; -// pub mod comparator; -// pub use self::comparator::*; - pub mod rca; pub use self::rca::*;