Update DoubleEndedQueue.sol

pull/4150/head
Hadrien Croubois 2 years ago committed by GitHub
parent 1199e602d1
commit 1294d4bc10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      contracts/utils/structs/DoubleEndedQueue.sol

@ -27,7 +27,7 @@ library DoubleEndedQueue {
/**
* @dev A push operation couldn't be completed due to the queue being full.
*/
error Full();
error QueueFull();
/**
* @dev An operation (e.g. {at}) couldn't be completed due to an index being out of bounds.
@ -58,7 +58,7 @@ library DoubleEndedQueue {
function pushBack(Bytes32Deque storage deque, bytes32 value) internal {
unchecked {
uint128 backIndex = deque._end;
if (backIndex + 1 == deque._begin) revert Full();
if (backIndex + 1 == deque._begin) revert QueueFull();
deque._data[backIndex] = value;
deque._end = backIndex + 1;
}
@ -86,7 +86,7 @@ library DoubleEndedQueue {
function pushFront(Bytes32Deque storage deque, bytes32 value) internal {
unchecked {
uint128 frontIndex = deque._begin - 1;
if (frontIndex == deque._end) revert Full();
if (frontIndex == deque._end) revert QueueFull();
deque._data[frontIndex] = value;
deque._begin = frontIndex;
}

Loading…
Cancel
Save