{
    "Function": "slitherConstructorConstantVariables",
    "File": "src/libraries/BinHelper.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "library BinHelper {\n    using Math128x128 for uint256;\n\n    int256 private constant REAL_ID_SHIFT = 1 << 23;\n\n    /// @notice Returns the id corresponding to the given price\n    /// @dev The id may be inaccurate due to rounding issues, always trust getPriceFromId rather than\n    /// getIdFromPrice\n    /// @param _price The price of y per x as a 128.128-binary fixed-point number\n    /// @param _binStep The bin step\n    /// @return The id corresponding to this price\n    function getIdFromPrice(uint256 _price, uint256 _binStep) internal pure returns (uint24) {\n        unchecked {\n            uint256 _binStepValue = _getBPValue(_binStep);\n\n            // can't overflow as `2**23 + log2(price) < 2**23 + 2**128 < max(uint256)`\n            int256 _id = REAL_ID_SHIFT + _price.log2() / _binStepValue.log2();\n\n            if (_id < 0 || uint256(_id) > type(uint24).max) revert BinHelper__IdOverflows(_id);\n            return uint24(uint256(_id));\n        }\n    }\n\n    /// @notice Returns the price corresponding to the given ID, as a 128.128-binary fixed-point number\n    /// @dev This is the trusted function to link id to price, the other way may be inaccurate\n    /// @param _id The id\n    /// @param _binStep The bin step\n    /// @return The price corresponding to this id, as a 128.128-binary fixed-point number\n    function getPriceFromId(uint256 _id, uint256 _binStep) internal pure returns (uint256) {\n        if (_id > uint256(type(int256).max)) revert BinHelper__IntOverflows(_id);\n        unchecked {\n            int256 _realId = int256(_id) - REAL_ID_SHIFT;\n\n            return _getBPValue(_binStep).power(_realId);\n        }\n    }\n\n    /// @notice Returns the (1 + bp) value as a 128.128-decimal fixed-point number\n    /// @param _binStep The bp value in [1; 100] (referring to 0.01% to 1%)\n    /// @return The (1+bp) value as a 128.128-decimal fixed-point number\n    function _getBPValue(uint256 _binStep) internal pure returns (uint256) {\n        if (_binStep == 0 || _binStep > Constants.BASIS_POINT_MAX) revert BinHelper__BinStepOverflows(_binStep);\n\n        unchecked {\n            // can't overflow as `max(result) = 2**128 + 10_000 << 128 / 10_000 < max(uint256)`\n            return Constants.SCALE + (_binStep << Constants.SCALE_OFFSET) / Constants.BASIS_POINT_MAX;\n        }\n    }\n}"
}