mirror of
https://github.com/logos-storage/circom-witnessgen.git
synced 2026-01-05 22:43:10 +00:00
update Haskell to handle the "new" (previously missing from upstream) unary operations
This commit is contained in:
parent
87316bb87b
commit
4a8f564ba9
@ -22,6 +22,8 @@ data Graph = Graph
|
||||
data UnoOp
|
||||
= Neg -- ^ @= 0@
|
||||
| Id -- ^ @= 1@
|
||||
| Lnot -- ^ @= 2@
|
||||
| Bnot -- ^ @= 3@
|
||||
deriving (Eq,Enum,Bounded,Show)
|
||||
|
||||
data DuoOp
|
||||
|
||||
@ -18,6 +18,8 @@ data PrimOp a
|
||||
-- unary
|
||||
= Neg a
|
||||
| Id a
|
||||
| Lnot a
|
||||
| Bnot a
|
||||
-- binary
|
||||
| Mul a a
|
||||
| Div a a
|
||||
@ -49,6 +51,8 @@ evalPrimOp :: PrimOp F -> F
|
||||
evalPrimOp prim = case prim of
|
||||
Neg x -> neg x
|
||||
Id x -> x
|
||||
Lnot x -> fromBool (not (toBool x))
|
||||
Bnot x -> toF (fieldMask .&. (negate (fromF x) - 1))
|
||||
Mul x y -> mul x y
|
||||
Div x y -> BN254.div x y
|
||||
Add x y -> add x y
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user