use super::*;
impl<E: Environment> Equal for Field<E> {
type Output = Boolean<E>;
fn is_equal(&self, other: &Self) -> Self::Output {
Boolean::new(self == other)
}
fn is_not_equal(&self, other: &Self) -> Self::Output {
Boolean::new(self != other)
}
}
impl<E: Environment> Compare for Field<E> {
type Output = Boolean<E>;
fn is_less_than(&self, other: &Self) -> Self::Output {
Boolean::new(self.field < other.field)
}
fn is_greater_than(&self, other: &Self) -> Self::Output {
other.is_less_than(self)
}
fn is_less_than_or_equal(&self, other: &Self) -> Self::Output {
other.is_greater_than_or_equal(self)
}
fn is_greater_than_or_equal(&self, other: &Self) -> Self::Output {
!self.is_less_than(other)
}
}
impl<E: Environment> Ternary for Field<E> {
type Boolean = Boolean<E>;
type Output = Self;
fn ternary(condition: &Self::Boolean, first: &Self, second: &Self) -> Self::Output {
match **condition {
true => *first,
false => *second,
}
}
}