Add CircularBuffer data structure (#4913)

Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
Hadrien Croubois
2024-04-26 18:28:59 +02:00
committed by GitHub
parent 60697cb09a
commit c80b675b8d
7 changed files with 223 additions and 0 deletions

View File

@ -356,6 +356,7 @@ const unsafeSetLength = type => `
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(${type}[] storage array, uint256 len) internal {
/// @solidity memory-safe-assembly
assembly {
sstore(array.slot, len)
}