Uniswap / v4-core

🦄 🦄 🦄 🦄 Core smart contracts of Uniswap v4
https://blog.uniswap.org/uniswap-v4
2.04k stars 987 forks source link

perf: Refactor `BitMath` and use it in `TickMath.getTickAtSqrtPrice` #822

Closed shuhuiluo closed 3 months ago

shuhuiluo commented 3 months ago

Related Issue

Which issue does this pull request resolve?

Description of changes

Now that Solady bit math is imported, the original mostSignificantBit implementation expanded in TickMath.getTickAtSqrtPrice should be replaced by a call to BitMath.mostSignificantBit.

Also refactor BitMath a bit for more performance.

hensha256 commented 3 months ago

for our note - this is relevant to both Spearbit#7 and Spearbit#43