-
-
Save aviggiano/7dfb233ccfe75f14d4d6a39a2bbcb2bc to your computer and use it in GitHub Desktop.
IMath.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
interface IMath { | |
/// @notice Find the index of `value` in the sorted list `array` | |
/// @dev If `value` is below the lowest value in `array` or above the highest | |
/// value in `array`, the function returns | |
/// (type(uint256).max, type(uint256).max) | |
/// @param array The sorted list to search | |
/// @param value The value to search for | |
/// @return low The index of the largest element in `array` that is less than | |
/// or equal to `value` | |
/// @return high The index of the smallest element in `array` that is greater than | |
/// or equal to `value` | |
function binarySearch(uint256[] memory array, uint256 value) external | |
pure returns (uint256 low, uint256 high); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment