@@ -15,7 +15,7 @@ library AssociatedArrayLib {
1515 }
1616
1717 function _slot (Array storage s , address account ) private pure returns (bytes32 __slot ) {
18- assembly {
18+ assembly ( "memory-safe" ) {
1919 mstore (0x00 , account)
2020 mstore (0x20 , s.slot)
2121 __slot := keccak256 (0x00 , 0x40 )
@@ -24,7 +24,7 @@ library AssociatedArrayLib {
2424
2525 function _length (Array storage s , address account ) private view returns (uint256 __length ) {
2626 bytes32 slot = _slot (s, account);
27- assembly {
27+ assembly ( "memory-safe" ) {
2828 __length := sload (slot)
2929 }
3030 }
@@ -34,7 +34,7 @@ library AssociatedArrayLib {
3434 }
3535
3636 function _get (bytes32 slot , uint256 index ) private view returns (bytes32 value ) {
37- assembly {
37+ assembly ( "memory-safe" ) {
3838 //if (index >= _length(s, account)) revert AssociatedArray_OutOfBounds(index);
3939 if iszero (lt (index, sload (slot))) {
4040 mstore (0 , 0x8277484f ) // `AssociatedArray_OutOfBounds(uint256)`
@@ -48,7 +48,7 @@ library AssociatedArrayLib {
4848 function _getAll (Array storage s , address account ) private view returns (bytes32 [] memory values ) {
4949 bytes32 slot = _slot (s, account);
5050 uint256 __length;
51- assembly {
51+ assembly ( "memory-safe" ) {
5252 __length := sload (slot)
5353 }
5454 values = new bytes32 [](__length);
@@ -63,7 +63,7 @@ library AssociatedArrayLib {
6363 function _contains (Array storage s , address account , bytes32 value ) private view returns (bool ) {
6464 bytes32 slot = _slot (s, account);
6565 uint256 __length;
66- assembly {
66+ assembly ( "memory-safe" ) {
6767 __length := sload (slot)
6868 }
6969 for (uint256 i; i < __length; i++ ) {
@@ -79,7 +79,7 @@ library AssociatedArrayLib {
7979 }
8080
8181 function _set (bytes32 slot , uint256 index , bytes32 value ) private {
82- assembly {
82+ assembly ( "memory-safe" ) {
8383 //if (index >= _length(s, account)) revert AssociatedArray_OutOfBounds(index);
8484 if iszero (lt (index, sload (slot))) {
8585 mstore (0 , 0x8277484f ) // `AssociatedArray_OutOfBounds(uint256)`
@@ -92,7 +92,7 @@ library AssociatedArrayLib {
9292
9393 function _push (Array storage s , address account , bytes32 value ) private {
9494 bytes32 slot = _slot (s, account);
95- assembly {
95+ assembly ( "memory-safe" ) {
9696 // load length (stored @ slot), add 1 to it => index.
9797 // mul index by 0x20 and add it to orig slot to get the next free slot
9898 let index := add (sload (slot), 1 )
@@ -104,20 +104,20 @@ library AssociatedArrayLib {
104104 function _pop (Array storage s , address account ) private {
105105 bytes32 slot = _slot (s, account);
106106 uint256 __length;
107- assembly {
107+ assembly ( "memory-safe" ) {
108108 __length := sload (slot)
109109 }
110110 if (__length == 0 ) return ;
111111 _set (slot, __length - 1 , 0 );
112- assembly {
112+ assembly ( "memory-safe" ) {
113113 sstore (slot, sub (__length, 1 ))
114114 }
115115 }
116116
117117 function _remove (Array storage s , address account , uint256 index ) private {
118118 bytes32 slot = _slot (s, account);
119119 uint256 __length;
120- assembly {
120+ assembly ( "memory-safe" ) {
121121 __length := sload (slot)
122122 if iszero (lt (index, __length)) {
123123 mstore (0 , 0x8277484f ) // `AssociatedArray_OutOfBounds(uint256)`
@@ -127,7 +127,7 @@ library AssociatedArrayLib {
127127 }
128128 _set (slot, index, _get (s, account, __length - 1 ));
129129
130- assembly {
130+ assembly ( "memory-safe" ) {
131131 // clear the last slot
132132 // this is the 'unchecked' version of _set(slot, __length - 1, 0)
133133 // as we use length-1 as index, so the check is excessive.
@@ -197,7 +197,7 @@ library AssociatedArrayLib {
197197 address [] memory addressArray;
198198
199199 /// @solidity memory-safe-assembly
200- assembly {
200+ assembly ( "memory-safe" ) {
201201 addressArray := bytes32Array
202202 }
203203 return addressArray;
@@ -246,7 +246,7 @@ library AssociatedArrayLib {
246246 uint256 [] memory uintArray;
247247
248248 /// @solidity memory-safe-assembly
249- assembly {
249+ assembly ( "memory-safe" ) {
250250 uintArray := bytes32Array
251251 }
252252 return uintArray;
0 commit comments