Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toUint24 removed? #48

Open
OxMarco opened this issue Sep 12, 2021 · 2 comments
Open

toUint24 removed? #48

OxMarco opened this issue Sep 12, 2021 · 2 comments

Comments

@OxMarco
Copy link

OxMarco commented Sep 12, 2021

Why was the "toUint24" method removed?

Here is the rather simple code to implement it:

function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {
        require(_bytes.length >= _start + 3, "toUint24_outOfBounds");
        uint24 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x3), _start))
        }

        return tempUint;
}
@gzliudan
Copy link

The function toUint24 is needed sometimes.

@krishan1908
Copy link

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants