@@ -15,56 +15,58 @@ A library that provides utility functions for memory manipulation in Solidity.
1515
1616``` solidity
1717function copy(
18- string memory source_
19- ) internal view returns (string memory destination_)
18+ bytes memory source_
19+ ) internal view returns (bytes memory destination_)
2020```
2121
22- Copies the contents of the source string to the destination string.
22+ Copies the contents of the source bytes to the destination bytes. strings can be casted
23+ to bytes in order to use this function.
2324
2425
2526
2627Parameters:
2728
28- | Name | Type | Description |
29- | :------ | :----- | :- ------------------------------ |
30- | source_ | string | The source string to copy from. |
29+ | Name | Type | Description |
30+ | :------ | :---- | :------------------------------ |
31+ | source_ | bytes | The source bytes to copy from. |
3132
3233
3334Return values:
3435
35- | Name | Type | Description |
36- | :----------- | :----- | :- ------------------------- |
37- | destination_ | string | The newly allocated string . |
36+ | Name | Type | Description |
37+ | :----------- | :---- | :------------------------- |
38+ | destination_ | bytes | The newly allocated bytes . |
3839
3940### copy
4041
4142``` solidity
4243function copy(
43- bytes memory source_
44- ) internal view returns (bytes memory destination_)
44+ bytes32[] memory source_
45+ ) internal view returns (bytes32[] memory destination_)
4546```
4647
47- Copies the contents of the source bytes to the destination bytes.
48+ Copies the contents of the source bytes32 array to the destination bytes32 array.
49+ uint256[ ] , address[ ] array can be casted to bytes32[ ] via ` TypeCaster ` library.
4850
4951
5052
5153Parameters:
5254
53- | Name | Type | Description |
54- | :------ | :---- | :------------------------------ |
55- | source_ | bytes | The source bytes to copy from. |
55+ | Name | Type | Description |
56+ | :------ | :-------- | :-------- ------------------------------ |
57+ | source_ | bytes32 [ ] | The source bytes32 array to copy from. |
5658
5759
5860Return values:
5961
60- | Name | Type | Description |
61- | :----------- | :---- | :------------------------- |
62- | destination_ | bytes | The newly allocated bytes . |
62+ | Name | Type | Description |
63+ | :----------- | :-------- | :-------- ------------------------- |
64+ | destination_ | bytes32 [ ] | The newly allocated bytes32 array . |
6365
64- ### unsafeMemoryCopy
66+ ### unsafeCopy
6567
6668``` solidity
67- function unsafeMemoryCopy (
69+ function unsafeCopy (
6870 uint256 sourcePointer_,
6971 uint256 destinationPointer_,
7072 uint256 size_
@@ -89,14 +91,38 @@ Parameters:
8991### getPointer
9092
9193``` solidity
92- function getPointer(bytes memory data) internal pure returns (uint256 pointer)
94+ function getPointer(
95+ bytes memory data_
96+ ) internal pure returns (uint256 pointer_)
9397```
9498
95- Returns the memory pointer of the given bytes data .
99+ Returns the memory pointer to the given bytes starting position including the length .
96100### getPointer
97101
98102``` solidity
99- function getPointer(string memory data) internal pure returns (uint256 pointer)
103+ function getPointer(
104+ bytes32[] memory data_
105+ ) internal pure returns (uint256 pointer_)
106+ ```
107+
108+ Returns the memory pointer to the given bytes starting position including the length.
109+ Cast uint256[ ] and address[ ] to bytes32[ ] via ` TypeCaster ` library.
110+ ### getDataPointer
111+
112+ ``` solidity
113+ function getDataPointer(
114+ bytes memory data_
115+ ) internal pure returns (uint256 pointer_)
116+ ```
117+
118+ Returns the memory pointer to the given bytes data starting position skipping the length.
119+ ### getDataPointer
120+
121+ ``` solidity
122+ function getDataPointer(
123+ bytes32[] memory data_
124+ ) internal pure returns (uint256 pointer_)
100125```
101126
102- Returns the memory pointer of the given string data.
127+ Returns the memory pointer to the given bytes data starting position skipping the length.
128+ Cast uint256[ ] and address[ ] to bytes32[ ] via ` TypeCaster ` library.
0 commit comments