Update DoubleEndedQueue.sol

This commit is contained in:
Hadrien Croubois
2023-07-07 14:27:41 +02:00
committed by GitHub
parent 1199e602d1
commit 1294d4bc10

View File

@ -27,7 +27,7 @@ library DoubleEndedQueue {
/** /**
* @dev A push operation couldn't be completed due to the queue being full. * @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. * @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 { function pushBack(Bytes32Deque storage deque, bytes32 value) internal {
unchecked { unchecked {
uint128 backIndex = deque._end; uint128 backIndex = deque._end;
if (backIndex + 1 == deque._begin) revert Full(); if (backIndex + 1 == deque._begin) revert QueueFull();
deque._data[backIndex] = value; deque._data[backIndex] = value;
deque._end = backIndex + 1; deque._end = backIndex + 1;
} }
@ -86,7 +86,7 @@ library DoubleEndedQueue {
function pushFront(Bytes32Deque storage deque, bytes32 value) internal { function pushFront(Bytes32Deque storage deque, bytes32 value) internal {
unchecked { unchecked {
uint128 frontIndex = deque._begin - 1; uint128 frontIndex = deque._begin - 1;
if (frontIndex == deque._end) revert Full(); if (frontIndex == deque._end) revert QueueFull();
deque._data[frontIndex] = value; deque._data[frontIndex] = value;
deque._begin = frontIndex; deque._begin = frontIndex;
} }