Skip to content

Commit

Permalink
CI: 59b1654
Browse files Browse the repository at this point in the history
  • Loading branch information
Docs Syncer committed May 13, 2024
1 parent 34928c3 commit 01534d8
Showing 1 changed file with 50 additions and 24 deletions.
74 changes: 50 additions & 24 deletions docs/reference/contracts/libs/utils/MemoryUtils.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,56 +15,58 @@ A library that provides utility functions for memory manipulation in Solidity.

```solidity
function copy(
string memory source_
) internal view returns (string memory destination_)
bytes memory source_
) internal view returns (bytes memory destination_)
```

Copies the contents of the source string to the destination string.
Copies the contents of the source bytes to the destination bytes. strings can be casted
to bytes in order to use this function.



Parameters:

| Name | Type | Description |
| :------ | :----- | :------------------------------- |
| source_ | string | The source string to copy from. |
| Name | Type | Description |
| :------ | :---- | :------------------------------ |
| source_ | bytes | The source bytes to copy from. |


Return values:

| Name | Type | Description |
| :----------- | :----- | :-------------------------- |
| destination_ | string | The newly allocated string. |
| Name | Type | Description |
| :----------- | :---- | :------------------------- |
| destination_ | bytes | The newly allocated bytes. |

### copy

```solidity
function copy(
bytes memory source_
) internal view returns (bytes memory destination_)
bytes32[] memory source_
) internal view returns (bytes32[] memory destination_)
```

Copies the contents of the source bytes to the destination bytes.
Copies the contents of the source bytes32 array to the destination bytes32 array.
uint256[], address[] array can be casted to bytes32[] via `TypeCaster` library.



Parameters:

| Name | Type | Description |
| :------ | :---- | :------------------------------ |
| source_ | bytes | The source bytes to copy from. |
| Name | Type | Description |
| :------ | :-------- | :-------------------------------------- |
| source_ | bytes32[] | The source bytes32 array to copy from. |


Return values:

| Name | Type | Description |
| :----------- | :---- | :------------------------- |
| destination_ | bytes | The newly allocated bytes. |
| Name | Type | Description |
| :----------- | :-------- | :--------------------------------- |
| destination_ | bytes32[] | The newly allocated bytes32 array. |

### unsafeMemoryCopy
### unsafeCopy

```solidity
function unsafeMemoryCopy(
function unsafeCopy(
uint256 sourcePointer_,
uint256 destinationPointer_,
uint256 size_
Expand All @@ -89,14 +91,38 @@ Parameters:
### getPointer

```solidity
function getPointer(bytes memory data) internal pure returns (uint256 pointer)
function getPointer(
bytes memory data_
) internal pure returns (uint256 pointer_)
```

Returns the memory pointer of the given bytes data.
Returns the memory pointer to the given bytes starting position including the length.
### getPointer

```solidity
function getPointer(string memory data) internal pure returns (uint256 pointer)
function getPointer(
bytes32[] memory data_
) internal pure returns (uint256 pointer_)
```

Returns the memory pointer to the given bytes starting position including the length.
Cast uint256[] and address[] to bytes32[] via `TypeCaster` library.
### getDataPointer

```solidity
function getDataPointer(
bytes memory data_
) internal pure returns (uint256 pointer_)
```

Returns the memory pointer to the given bytes data starting position skipping the length.
### getDataPointer

```solidity
function getDataPointer(
bytes32[] memory data_
) internal pure returns (uint256 pointer_)
```

Returns the memory pointer of the given string data.
Returns the memory pointer to the given bytes data starting position skipping the length.
Cast uint256[] and address[] to bytes32[] via `TypeCaster` library.

0 comments on commit 01534d8

Please sign in to comment.