mirror of
https://github.com/status-im/codex-contracts-eth.git
synced 2025-02-12 08:26:46 +00:00
24 lines
504 B
Solidity
24 lines
504 B
Solidity
|
// SPDX-License-Identifier: MIT
|
||
|
pragma solidity ^0.8.8;
|
||
|
|
||
|
library Utils {
|
||
|
function _resize(bytes32[] memory array, uint8 newSize)
|
||
|
internal
|
||
|
pure
|
||
|
returns (bytes32[] memory)
|
||
|
{
|
||
|
require(newSize <= array.length, "size out of bounds");
|
||
|
|
||
|
if (newSize == 0) {
|
||
|
bytes32[] memory empty;
|
||
|
return empty;
|
||
|
} else {
|
||
|
bytes32[] memory sized = new bytes32[](newSize);
|
||
|
for (uint8 i = 0; i < newSize; i++) {
|
||
|
sized[i] = array[i];
|
||
|
}
|
||
|
return sized;
|
||
|
}
|
||
|
}
|
||
|
}
|