# PoolTicksCounter

### Functions <a href="#functions" id="functions"></a>

#### countInitializedTicksCrossed <a href="#countinitializedtickscrossed" id="countinitializedtickscrossed"></a>

*This function counts the number of initialized ticks that would incur a gas cost between tickBefore and tickAfter. When tickBefore and/or tickAfter themselves are initialized, the logic over whether we should count them depends on the direction of the swap. If we are swapping upwards (tickAfter > tickBefore) we don't want to count tickBefore but we do want to count tickAfter. The opposite is true if we are swapping downwards.*

```solidity
function countInitializedTicksCrossed(IDragonswapV2Pool self, int24 tickBefore, int24 tickAfter)
    internal
    view
    returns (uint32 initializedTicksCrossed);
```

#### countOneBits <a href="#countonebits" id="countonebits"></a>

```solidity
function countOneBits(uint256 x) private pure returns (uint16);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dragonswap.app/dragonswap/resources/developer-resources/smart-contracts/dragonswapv2/smart-router/libraries/pooltickscounter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
