Skip to content

How does it work? #1

@SeniorCSSdeveloper

Description

@SeniorCSSdeveloper

Thanks you for cool library.

Unfortunately I don't understand how does it work :-)

Can you please explain, e.g.

Why here

    /// @dev Returns the max value in an array.
    /// @param self Storage array containing uint256 type variables
    /// @return maxValue The highest value in the array
    function getMax(uint256[] storage self) public view returns(uint256 maxValue) {
        assembly {
            mstore(0x60,self_slot)
            maxValue := sload(sha3(0x60,0x20))

            for { let i := 0 } lt(i, sload(self_slot)) { i := add(i, 1) } {
                switch gt(sload(add(sha3(0x60,0x20),i)), maxValue)
                case 1 {
                    maxValue := sload(add(sha30x60,0x20),i))
                }
            }
        }
    }

you use sha3(0x60,0x20)? What does it mean?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions