File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -103,12 +103,22 @@ library Arrays {
103103 return slot.getUint256Slot ();
104104 }
105105
106+ /**
107+ * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
108+ *
109+ * WARNING: Only use if you are certain `pos` is lower than the array length.
110+ */
106111 function unsafeMemoryAccess (uint256 [] memory arr , uint256 pos ) internal pure returns (uint256 res ) {
107112 assembly {
108113 res := mload (add (add (arr, 0x20 ), mul (pos, 0x20 )))
109114 }
110115 }
111116
117+ /**
118+ * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
119+ *
120+ * WARNING: Only use if you are certain `pos` is lower than the array length.
121+ */
112122 function unsafeMemoryAccess (address [] memory arr , uint256 pos ) internal pure returns (address res ) {
113123 assembly {
114124 res := mload (add (add (arr, 0x20 ), mul (pos, 0x20 )))
You can’t perform that action at this time.
0 commit comments