v4-core
v4-core copied to clipboard
Use bit operation to perform modulo operations
Component
Gas Optimization, General design optimization (improving efficiency, cleanliness, or developer experience)
Describe the suggested feature and problem it solves.
Modular operations where the denominator is a power of 2, instead of doing this uint8 fee0 = fee % 16;
, we can simply do this uint8 fee0 = fee & (16 - 1);
and can we aslo add the unchecked block to the this part since it has no possibility of overflow or underflow
Describe the desired implementation.
http://graphics.stanford.edu/~seander/bithacks.html#ModulusDivisionEasy
Describe alternatives.
No response
Additional context.
No response
:sparkles: Thanks to the community, there's an estimated bounty value of $68.13 USD for a successful merge request of this issue via contributions such as 6.09375 UNI tokens. Happy coding :grinning: Details and T&Cs at joinfuel.io
@malik672 Can be closed.