Skip to content

Document costs of various types. #4122

Closed as not planned
Closed as not planned
@mudgen

Description

@mudgen

Does it cost any gas to cast a bytes32 memory value to uint256? What is the assembly op code for this?

Does it cost more gas to use =, >, <. operators with bytes32 than it does with uint256?

Spreadsheets about gas costs say it cost 3 gas for =, >, < operations, so is that true with all types that support those operators? Or is the gas cost for these operators different depending on the type?

I tested some of these things in remix and got mixed results -- sometimes it cost more gas, sometimes less.

Does it make any sense to cast bytes32 to unint256 for doing an operation like this: require(uint256(myvalue) != 0);

If you know the answers to these, can you please tell me how you know?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions