Page MenuHomePhabricator

OP_MUL implementation
AbandonedPublic

Authored by danconnolly on Jul 25 2018, 22:13.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

Implementation of OP_MUL for the magnetic upgrade. The specification for this opcode is here.

Overflow: The operands to the OP_MUL opcode must be valid numerical values, otherwise the opcode will fail. Numerical values are limited to 32-bits. The result of the OP_MUL opcode can be longer than 32-bits. A result of that size would not be considered a valid numerical value but it is a valid byte sequence. The product of two maximum sized numerical values will fit in a 64-bit integer and will not produce an overflow in the implementation. Tests exist in script_tests.json for these scenarios, currently at lines 1059-1060 & 1070-1071.

Test Plan

make check

Diff Detail

Branch
opcodes_mul
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 2961
Build 4021: arc lint + arc unit

Event Timeline

This comment was removed by danconnolly.

refactor based on re-organizing prior diffs

schancel added inline comments.
src/script/interpreter.cpp
758 ↗(On Diff #4540)

I was under the impression there was some overflow issue that needed to be addressed?

danconnolly edited the summary of this revision. (Show Details)
danconnolly added inline comments.
src/script/interpreter.cpp
758 ↗(On Diff #4540)

I've updated the revision description to describe the potential for overflow and the related tests.