GuildOfWeavers / distaff

Zero-knowledge virtual machine written in Rust
MIT License
244 stars 44 forks source link

Add isodd assembly instruction #26

Closed bobbinth closed 4 years ago

bobbinth commented 4 years ago

The semantic of isodd instruction could be as follows:

Pop the top value from the stack, if it is odd, push 1 onto the stack. Otherwise, push 0 onto the stack.

The format for the instruction would be isodd.n where n is the max number of bits needed to represent the top value of the stack. If top value of the stack is > 2n, the operation will fail.