snarkvm_circuit_program/data/literal/
equal.rs1use super::*;
17
18impl<A: Aleo> Equal<Self> for Literal<A> {
19 type Output = Boolean<A>;
20
21 fn is_equal(&self, other: &Self) -> Self::Output {
23 match (self, other) {
24 (Self::Address(a), Self::Address(b)) => a.is_equal(b),
25 (Self::Boolean(a), Self::Boolean(b)) => a.is_equal(b),
26 (Self::Field(a), Self::Field(b)) => a.is_equal(b),
27 (Self::Group(a), Self::Group(b)) => a.is_equal(b),
28 (Self::I8(a), Self::I8(b)) => a.is_equal(b),
29 (Self::I16(a), Self::I16(b)) => a.is_equal(b),
30 (Self::I32(a), Self::I32(b)) => a.is_equal(b),
31 (Self::I64(a), Self::I64(b)) => a.is_equal(b),
32 (Self::I128(a), Self::I128(b)) => a.is_equal(b),
33 (Self::U8(a), Self::U8(b)) => a.is_equal(b),
34 (Self::U16(a), Self::U16(b)) => a.is_equal(b),
35 (Self::U32(a), Self::U32(b)) => a.is_equal(b),
36 (Self::U64(a), Self::U64(b)) => a.is_equal(b),
37 (Self::U128(a), Self::U128(b)) => a.is_equal(b),
38 (Self::Scalar(a), Self::Scalar(b)) => a.is_equal(b),
39 (Self::Signature(a), Self::Signature(b)) => a.is_equal(b),
40 (Self::String(a), Self::String(b)) => a.is_equal(b),
41 _ => Boolean::constant(false),
42 }
43 }
44
45 fn is_not_equal(&self, other: &Self) -> Self::Output {
47 match (self, other) {
48 (Self::Address(a), Self::Address(b)) => a.is_not_equal(b),
49 (Self::Boolean(a), Self::Boolean(b)) => a.is_not_equal(b),
50 (Self::Field(a), Self::Field(b)) => a.is_not_equal(b),
51 (Self::Group(a), Self::Group(b)) => a.is_not_equal(b),
52 (Self::I8(a), Self::I8(b)) => a.is_not_equal(b),
53 (Self::I16(a), Self::I16(b)) => a.is_not_equal(b),
54 (Self::I32(a), Self::I32(b)) => a.is_not_equal(b),
55 (Self::I64(a), Self::I64(b)) => a.is_not_equal(b),
56 (Self::I128(a), Self::I128(b)) => a.is_not_equal(b),
57 (Self::U8(a), Self::U8(b)) => a.is_not_equal(b),
58 (Self::U16(a), Self::U16(b)) => a.is_not_equal(b),
59 (Self::U32(a), Self::U32(b)) => a.is_not_equal(b),
60 (Self::U64(a), Self::U64(b)) => a.is_not_equal(b),
61 (Self::U128(a), Self::U128(b)) => a.is_not_equal(b),
62 (Self::Scalar(a), Self::Scalar(b)) => a.is_not_equal(b),
63 (Self::Signature(a), Self::Signature(b)) => a.is_not_equal(b),
64 (Self::String(a), Self::String(b)) => a.is_not_equal(b),
65 _ => Boolean::constant(true),
66 }
67 }
68}