We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
🧐 Motivation
@Amxx Just an Idea, in the contract contracts/utils/Strings.sol there is a function called toString(uint256 value), which ends like:
toString(uint256 value)
while (true) { ptr--; assembly ("memory-safe") { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer;
My idea is to change the logical condition to:
while (value != 0) { ptr--; assembly ("memory-safe") { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; } return buffer;
Avoiding using break in loops helps minimize potential logical errors which may occur later on and it's best practice.
break
📝 Details
The text was updated successfully, but these errors were encountered:
Converted to a pull request Thanks
Sorry, something went wrong.
No branches or pull requests
🧐 Motivation
@Amxx
Just an Idea, in the contract contracts/utils/Strings.sol there is a function called
toString(uint256 value)
, which ends like:My idea is to change the logical condition to:
Avoiding using
break
in loops helps minimize potential logical errors which may occur later on and it's best practice.📝 Details
Change the logical condition of the while loop inside Strings.sol (please refer to the above)The text was updated successfully, but these errors were encountered: