You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contracts/utils/Bytes.sol
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ library Bytes {
13
13
* * If `s` is present in the buffer, returns the index of the first instance
14
14
* * If `s` is not present in the buffer, returns type(uint256).max
15
15
*
16
-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
16
+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]
17
17
*/
18
18
function indexOf(bytesmemorybuffer, bytes1s) internalpurereturns (uint256) {
19
19
returnindexOf(buffer, s, 0);
@@ -22,9 +22,9 @@ library Bytes {
22
22
/**
23
23
* @dev Forward search for `s` in `buffer` starting at position `pos`
24
24
* * If `s` is present in the buffer (at or after `pos`), returns the index of the next instance
25
-
* * If `s` is not present in the buffer (at or after `pos`), returns the length of the buffer
25
+
* * If `s` is not present in the buffer (at or after `pos`), returns type(uint256).max
26
26
*
27
-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
27
+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf[Javascript's `Array.indexOf`]
28
28
*/
29
29
function indexOf(bytesmemorybuffer, bytes1s, uint256pos) internalpurereturns (uint256) {
30
30
unchecked {
@@ -43,7 +43,7 @@ library Bytes {
43
43
* * If `s` is present in the buffer, returns the index of the last instance
44
44
* * If `s` is not present in the buffer, returns type(uint256).max
45
45
*
46
-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf
46
+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]
47
47
*/
48
48
function lastIndexOf(bytesmemorybuffer, bytes1s) internalpurereturns (uint256) {
49
49
returnlastIndexOf(buffer, s, type(uint256).max);
@@ -52,9 +52,9 @@ library Bytes {
52
52
/**
53
53
* @dev Backward search for `s` in `buffer` starting at position `pos`
54
54
* * If `s` is present in the buffer (at or before `pos`), returns the index of the previous instance
55
-
* * If `s` is not present in the buffer (at or before `pos`), returns the length of the buffer
55
+
* * If `s` is not present in the buffer (at or before `pos`), returns type(uint256).max
56
56
*
57
-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf
57
+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf[Javascript's `Array.lastIndexOf`]
58
58
*/
59
59
function lastIndexOf(bytesmemorybuffer, bytes1s, uint256pos) internalpurereturns (uint256) {
60
60
unchecked {
@@ -73,7 +73,7 @@ library Bytes {
73
73
* @dev Copies the content of `buffer`, from `start` (included) to the end of `buffer` into a new bytes object in
74
74
* memory.
75
75
*
76
-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
76
+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
77
77
*/
78
78
function slice(bytesmemorybuffer, uint256start) internalpurereturns (bytesmemory) {
79
79
returnslice(buffer, start, buffer.length);
@@ -83,7 +83,7 @@ library Bytes {
83
83
* @dev Copies the content of `buffer`, from `start` (included) to `end` (excluded) into a new bytes object in
84
84
* memory.
85
85
*
86
-
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
86
+
* NOTE: replicates the behavior of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice[Javascript's `Array.slice`]
87
87
*/
88
88
function slice(bytesmemorybuffer, uint256start, uint256end) internalpurereturns (bytesmemory) {
0 commit comments