Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some wrapped ops and some notes #86

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions arc-0004/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,34 @@ corresponding to the Aleo Instructions that can halt.

## Specification

Each flagged operation is identical to the current halting instruction
except it doesn't halt and it returns another return value that is a
boolean.
Each flagged operation is identical to its corresponding current operation
when called with arguments that would be nonhalting, except it returns
a second return value of type boolean that is **false** (meaning that the
current operation would not have halted). When called with arguments
that would have been halting, it generally returns 0 (of the appropriate
output type) and **true** ("would have halted") for the second return value.

The flagged operations are different from wrapped (e.g. `abs.w`) or
lossy (e.g. `cast.lossy`) operations. It is important that the flagged
operation have the same semantics as the current halting instruction
except for the halting behavior and extra return value, for ease of
use by compilers.

| Current Halting Opcode | New Flagged Opcode |
|:-------------------:|:-----------------------:|
| Current Halting Opcode | New Flagged Opcode | notes |
|:-------------------:|:-----------------------:|:--------------------------:|
| abs | abs.flagged |
| add | add.flagged |
| cast | cast.flagged |
| assert.eq | is.eq | We don't need a separate assert.(n)eq.flagged;
| assert.neq | is.neq | instead, just use the existing is.(n)eq
| cast | cast.flagged | as of now, docs don't say what causes cast to halt
| commit.bhp256 | commit.bhp256.flagged |
| commit.bhp512 | commit.bhp512.flagged |
| commit.bhp768 | commit.bhp768.flagged |
| commit.bhp768 | commit.bhp1024.flagged |
| commit.ped64 | commit.ped64.flagged |
| commit.ped128 | commit.ped128.flagged |
| div | div.flagged |
| div | div.flagged | div can halt on underflow and divide by zero
| div.w | div.w.flagged | div.w can halt on divide by zero
| hash.bhp256 | hash.bhp256.flagged |
| hash.bhp512 | hash.bhp512.flagged |
| hash.bhp768 | hash.bhp768.flagged |
Expand All @@ -59,9 +65,10 @@ use by compilers.
| mul | mul.flagged |
| neg | neg.flagged |
| pow | pow.flagged |
| rem | rem.flagged |
| shl | shl.flagged |
| shr | shr.flagged |
| rem | rem.flagged | rem can halt on underflow and divide by zero
| rem.w | rem.w.flagged | rem.w can halt on divide by zero
| shl | shl.flagged | as of now, docs don't say what causes
| shr | shr.flagged | shl or shr to halt
| sqrt | sqrt.flagged |
| sub | sub.flagged |

Expand Down
Loading