Skip to content

SMOD description #385

@rokk1t

Description

@rokk1t

https://www.evm.codes/?fork=cancun#07:

Note the overflow semantic when $−2^{255}$ is negated.

This is a controversial statement for this opcode.
There is no such statement in https://ethereum.github.io/yellowpaper/paper.pdf.

If needed, you may look deeper into implementation details:

The main point is that SDIV comment—
"Note the overflow semantic when $−2^{255}$ is negated."—
refers to an overflow case.
In contrast, SMOD does not overflow because its arithmetic logic disregards the sign of the second operand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions