snarkvm_console_types_boolean/
bitwise.rsuse super::*;
impl<E: Environment> Equal for Boolean<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> Not for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn not(self) -> Self::Output {
Boolean::new(!self.boolean)
}
}
impl<E: Environment> BitAnd<Boolean<E>> for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn bitand(self, other: Self) -> Self::Output {
Boolean::new(self.boolean & other.boolean)
}
}
impl<E: Environment> BitAnd<&Boolean<E>> for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn bitand(self, other: &Boolean<E>) -> Self::Output {
Boolean::new(self.boolean & other.boolean)
}
}
impl<E: Environment> BitAndAssign for Boolean<E> {
#[inline]
fn bitand_assign(&mut self, other: Self) {
*self = Boolean::new(self.boolean & other.boolean)
}
}
impl<E: Environment> BitOr for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn bitor(self, other: Self) -> Self::Output {
Boolean::new(self.boolean | other.boolean)
}
}
impl<E: Environment> BitOr<&Boolean<E>> for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn bitor(self, other: &Boolean<E>) -> Self::Output {
Boolean::new(self.boolean | other.boolean)
}
}
impl<E: Environment> BitOrAssign for Boolean<E> {
#[inline]
fn bitor_assign(&mut self, other: Self) {
*self = Boolean::new(self.boolean | other.boolean)
}
}
impl<E: Environment> BitXor for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn bitxor(self, other: Self) -> Self::Output {
Boolean::new(self.boolean ^ other.boolean)
}
}
impl<E: Environment> BitXor<&Boolean<E>> for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn bitxor(self, other: &Boolean<E>) -> Self::Output {
Boolean::new(self.boolean ^ other.boolean)
}
}
impl<E: Environment> BitXorAssign for Boolean<E> {
#[inline]
fn bitxor_assign(&mut self, other: Self) {
*self = Boolean::new(self.boolean ^ other.boolean)
}
}
impl<E: Environment> Nand for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn nand(&self, other: &Self) -> Self::Output {
Boolean::new(!(self.boolean & other.boolean))
}
}
impl<E: Environment> Nor for Boolean<E> {
type Output = Boolean<E>;
#[inline]
fn nor(&self, other: &Self) -> Self::Output {
Boolean::new(!(self.boolean | other.boolean))
}
}
impl<E: Environment> Ternary for Boolean<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,
}
}
}