-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from namnc/integrate-boolify
integrate boolify
- Loading branch information
Showing
12 changed files
with
128 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use circom_program_structure::ast::ExpressionInfixOpcode; | ||
use serde::{Deserialize, Serialize}; | ||
use strum_macros::{Display as StrumDisplay, EnumString}; | ||
|
||
/// The supported Arithmetic gate types. | ||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, EnumString, StrumDisplay)] | ||
pub enum AGateType { | ||
AAdd, | ||
ADiv, | ||
AEq, | ||
AGEq, | ||
AGt, | ||
ALEq, | ||
ALt, | ||
AMul, | ||
ANeq, | ||
ASub, | ||
AXor, | ||
APow, | ||
AIntDiv, | ||
AMod, | ||
AShiftL, | ||
AShiftR, | ||
ABoolOr, | ||
ABoolAnd, | ||
ABitOr, | ||
ABitAnd, | ||
} | ||
|
||
impl From<&ExpressionInfixOpcode> for AGateType { | ||
fn from(opcode: &ExpressionInfixOpcode) -> Self { | ||
match opcode { | ||
ExpressionInfixOpcode::Mul => AGateType::AMul, | ||
ExpressionInfixOpcode::Div => AGateType::ADiv, | ||
ExpressionInfixOpcode::Add => AGateType::AAdd, | ||
ExpressionInfixOpcode::Sub => AGateType::ASub, | ||
ExpressionInfixOpcode::Pow => AGateType::APow, | ||
ExpressionInfixOpcode::IntDiv => AGateType::AIntDiv, | ||
ExpressionInfixOpcode::Mod => AGateType::AMod, | ||
ExpressionInfixOpcode::ShiftL => AGateType::AShiftL, | ||
ExpressionInfixOpcode::ShiftR => AGateType::AShiftR, | ||
ExpressionInfixOpcode::LesserEq => AGateType::ALEq, | ||
ExpressionInfixOpcode::GreaterEq => AGateType::AGEq, | ||
ExpressionInfixOpcode::Lesser => AGateType::ALt, | ||
ExpressionInfixOpcode::Greater => AGateType::AGt, | ||
ExpressionInfixOpcode::Eq => AGateType::AEq, | ||
ExpressionInfixOpcode::NotEq => AGateType::ANeq, | ||
ExpressionInfixOpcode::BoolOr => AGateType::ABoolOr, | ||
ExpressionInfixOpcode::BoolAnd => AGateType::ABoolAnd, | ||
ExpressionInfixOpcode::BitOr => AGateType::ABitOr, | ||
ExpressionInfixOpcode::BitAnd => AGateType::ABitAnd, | ||
ExpressionInfixOpcode::BitXor => AGateType::AXor, | ||
} | ||
} | ||
} |
Oops, something went wrong.