Locate the correct Uniswap v3 bitmap word below tick zero

A negative search tick that is not aligned to tick spacing exposes a common off-by-one in initialized-tick scanners. Truncation toward zero inspects the wrong bitmap word.

Compress the search tick using floor semantics

For a downward search from tick minus one with spacing ten, floor the quotient to minus one. Split the signed compressed tick into a signed word index and its eight low bits as the bit position. The example yields word minus one and bit 255.

tick = -1, spacing = 10
compressed floor = -1
word = -1; bit = 255

An implementation that truncates to zero would inspect word zero. Replicate the direction-specific masks used by nextInitializedTickWithinOneWord, including the distinction between inclusive downward search and exclusive upward search.

Continue scanning when a word has no set bit

The helper returns a boundary and an initialized flag. A boundary with false is not a liquidity-changing tick. Advance across words in the proper direction and respect supported tick bounds and the pool’s actual tick spacing. github.com TickBitmap.sol