-
Notifications
You must be signed in to change notification settings - Fork 82
Open
0 / 20 of 2 issues completedLabels
cashc-compilerRelates to the cashc compilerRelates to the cashc compiler
Milestone
Description
Currently some casts will actually call conversion like int() resulting in compiled bytecode using OP_BIN2NUM.
In some cases, when the user knows that the hex will be a valid script number this will be terribly wasteful.
Consider this:
int a=1;
bytes1 b=0x01;
require((bytes) a == b);
it would compile to OP_1 OP_1 OP_EQUALVERIFY
while
int a=1;
bytes1 b=0x01;
require(a == (int) b);
would compile to OP_1 OP_1 OP_NUMEQUALVERIFY
.
What if b is not a valid int encoding? Then still compile the same but compiled Script would fail due to OP_NUMEQUALVERIFY erroring.
Sub-issues
Metadata
Metadata
Assignees
Labels
cashc-compilerRelates to the cashc compilerRelates to the cashc compiler