|
|
|
@ -151,7 +151,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none. |
|
|
|
|
* @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none. |
|
|
|
|
* `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`. |
|
|
|
|
* |
|
|
|
|
* WARNING: `high` should not be greater than the array's length. |
|
|
|
@ -174,7 +174,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none. |
|
|
|
|
* @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none. |
|
|
|
|
* `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`. |
|
|
|
|
* |
|
|
|
|
* WARNING: `high` should not be greater than the array's length. |
|
|
|
@ -225,7 +225,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Returns the value in the oldest checkpoint with key greater or equal than the search key, or zero if there is none. |
|
|
|
|
* @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none. |
|
|
|
|
*/ |
|
|
|
|
function lowerLookup(Trace224 storage self, uint32 key) internal view returns (uint224) { |
|
|
|
|
uint256 len = self._checkpoints.length; |
|
|
|
@ -234,7 +234,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Returns the value in the most recent checkpoint with key lower or equal than the search key. |
|
|
|
|
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key. |
|
|
|
|
*/ |
|
|
|
|
function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) { |
|
|
|
|
uint256 len = self._checkpoints.length; |
|
|
|
@ -243,7 +243,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Returns the value in the most recent checkpoint with key lower or equal than the search key. |
|
|
|
|
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key. |
|
|
|
|
* |
|
|
|
|
* NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high keys). |
|
|
|
|
*/ |
|
|
|
@ -324,7 +324,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none. |
|
|
|
|
* @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none. |
|
|
|
|
* `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`. |
|
|
|
|
* |
|
|
|
|
* WARNING: `high` should not be greater than the array's length. |
|
|
|
@ -347,7 +347,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none. |
|
|
|
|
* @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none. |
|
|
|
|
* `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`. |
|
|
|
|
* |
|
|
|
|
* WARNING: `high` should not be greater than the array's length. |
|
|
|
@ -401,7 +401,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Returns the value in the oldest checkpoint with key greater or equal than the search key, or zero if there is none. |
|
|
|
|
* @dev Returns the value in the first (oldest) checkpoint with key greater or equal than the search key, or zero if there is none. |
|
|
|
|
*/ |
|
|
|
|
function lowerLookup(Trace160 storage self, uint96 key) internal view returns (uint160) { |
|
|
|
|
uint256 len = self._checkpoints.length; |
|
|
|
@ -410,7 +410,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Returns the value in the most recent checkpoint with key lower or equal than the search key. |
|
|
|
|
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key. |
|
|
|
|
*/ |
|
|
|
|
function upperLookup(Trace160 storage self, uint96 key) internal view returns (uint160) { |
|
|
|
|
uint256 len = self._checkpoints.length; |
|
|
|
@ -419,7 +419,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Returns the value in the most recent checkpoint with key lower or equal than the search key. |
|
|
|
|
* @dev Returns the value in the last (most recent) checkpoint with key lower or equal than the search key. |
|
|
|
|
* |
|
|
|
|
* NOTE: This is a variant of {upperLookup} that is optimised to find "recent" checkpoint (checkpoints with high keys). |
|
|
|
|
*/ |
|
|
|
@ -500,7 +500,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none. |
|
|
|
|
* @dev Return the index of the last (most recent) checkpoint with key lower or equal than the search key, or `high` if there is none. |
|
|
|
|
* `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`. |
|
|
|
|
* |
|
|
|
|
* WARNING: `high` should not be greater than the array's length. |
|
|
|
@ -523,7 +523,7 @@ library Checkpoints { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none. |
|
|
|
|
* @dev Return the index of the first (oldest) checkpoint with key is greater or equal than the search key, or `high` if there is none. |
|
|
|
|
* `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`. |
|
|
|
|
* |
|
|
|
|
* WARNING: `high` should not be greater than the array's length. |
|
|
|
|