snarkvm_circuit_program/data/value/
equal.rs1use super::*;
17
18impl<A: Aleo> Equal<Self> for Value<A> {
19 type Output = Boolean<A>;
20
21 fn is_equal(&self, other: &Self) -> Self::Output {
23 match (self, other) {
24 (Self::Plaintext(a), Self::Plaintext(b)) => a.is_equal(b),
25 (Self::Record(a), Self::Record(b)) => a.is_equal(b),
26 (Self::Future(a), Self::Future(b)) => a.is_equal(b),
27 (Self::DynamicRecord(a), Self::DynamicRecord(b)) => a.is_equal(b),
28 (Self::DynamicFuture(a), Self::DynamicFuture(b)) => a.is_equal(b),
29 (Self::Plaintext(..), _)
30 | (Self::Record(..), _)
31 | (Self::Future(..), _)
32 | (Self::DynamicRecord(..), _)
33 | (Self::DynamicFuture(..), _) => Boolean::constant(false),
34 }
35 }
36
37 fn is_not_equal(&self, other: &Self) -> Self::Output {
39 match (self, other) {
40 (Self::Plaintext(a), Self::Plaintext(b)) => a.is_not_equal(b),
41 (Self::Record(a), Self::Record(b)) => a.is_not_equal(b),
42 (Self::Future(a), Self::Future(b)) => a.is_not_equal(b),
43 (Self::DynamicRecord(a), Self::DynamicRecord(b)) => a.is_not_equal(b),
44 (Self::DynamicFuture(a), Self::DynamicFuture(b)) => a.is_not_equal(b),
45 (Self::Plaintext(..), _)
46 | (Self::Record(..), _)
47 | (Self::Future(..), _)
48 | (Self::DynamicRecord(..), _)
49 | (Self::DynamicFuture(..), _) => Boolean::constant(true),
50 }
51 }
52}