aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-06-08 02:43:17 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-06-08 06:39:40 +0800
commit5bb7219f4b8d5ce22169d5139bd1c07d7b2fcafd (patch)
tree91756ef3a273709143ea0d8ef9bfedec731d17b7 /packages/contracts/src
parentf0200ab69722a7913671f3e59ab650da1e77d6ef (diff)
downloaddexon-0x-contracts-5bb7219f4b8d5ce22169d5139bd1c07d7b2fcafd.tar
dexon-0x-contracts-5bb7219f4b8d5ce22169d5139bd1c07d7b2fcafd.tar.gz
dexon-0x-contracts-5bb7219f4b8d5ce22169d5139bd1c07d7b2fcafd.tar.bz2
dexon-0x-contracts-5bb7219f4b8d5ce22169d5139bd1c07d7b2fcafd.tar.lz
dexon-0x-contracts-5bb7219f4b8d5ce22169d5139bd1c07d7b2fcafd.tar.xz
dexon-0x-contracts-5bb7219f4b8d5ce22169d5139bd1c07d7b2fcafd.tar.zst
dexon-0x-contracts-5bb7219f4b8d5ce22169d5139bd1c07d7b2fcafd.zip
Camelcase in memCopy
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol8
-rw-r--r--packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol4
-rw-r--r--packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol32
3 files changed, 22 insertions, 22 deletions
diff --git a/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol b/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol
index 076bee24c..b7e2e06b8 100644
--- a/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol
+++ b/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol
@@ -25,11 +25,11 @@ contract TestLibMem is
{
/// @dev Copies a block of memory from one location to another.
- /// @param mem Memory contents we want to apply memcpy to
+ /// @param mem Memory contents we want to apply memCopy to
/// @param dest Destination offset into <mem>.
/// @param source Source offset into <mem>.
/// @param length Length of bytes to copy from <source> to <dest>
- /// @return mem Memory contents after calling memcpy.
+ /// @return mem Memory contents after calling memCopy.
function testMemcpy(
bytes mem,
uint256 dest,
@@ -47,8 +47,8 @@ contract TestLibMem is
// Get pointer to memory contents
uint256 offset = getMemAddress(mem) + 32;
- // Execute memcpy adjusted for memory array location
- memcpy(offset + dest, offset + source, length);
+ // Execute memCopy adjusted for memory array location
+ memCopy(offset + dest, offset + source, length);
// Return modified memory contents
return mem;
diff --git a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
index 282455ea0..4f9e2f152 100644
--- a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
+++ b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
@@ -311,7 +311,7 @@ contract LibBytes is
// Allocate memory and copy value to result
result = new bytes(nestedBytesLength);
- memcpy(
+ memCopy(
getMemAddress(result) + 32, // +32 skips array length
getMemAddress(b) + index + 32,
nestedBytesLength
@@ -340,7 +340,7 @@ contract LibBytes is
);
// Copy <input> into <b>
- memcpy(
+ memCopy(
getMemAddress(b) + 32 + index, // +32 to skip length of <b>
getMemAddress(input), // includes length of <input>
input.length + 32 // +32 bytes to store <input> length
diff --git a/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol b/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol
index 960850725..6afb9973a 100644
--- a/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol
+++ b/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol
@@ -39,7 +39,7 @@ contract LibMem
/// @param dest memory address to copy bytes to.
/// @param source memory address to copy bytes from.
/// @param length number of bytes to copy.
- function memcpy(
+ function memCopy(
uint256 dest,
uint256 source,
uint256 length
@@ -81,42 +81,42 @@ contract LibMem
if (source > dest) {
assembly {
// Record the total number of full words to copy
- let nwords := div(length, 32)
+ let nWords := div(length, 32)
- // We subtract 32 from `send` and `dend` because it
+ // We subtract 32 from `sEnd` and `dEnd` because it
// is easier to compare with in the loop, and these
// are also the addresses we need for copying the
// last bytes.
length := sub(length, 32)
- let send := add(source, length)
- let dend := add(dest, length)
+ let sEnd := add(source, length)
+ let dEnd := add(dest, length)
// Remember the last 32 bytes of source
// This needs to be done here and not after the loop
// because we may have overwritten the last bytes in
// source already due to overlap.
- let last := mload(send)
+ let last := mload(sEnd)
// Copy whole words front to back
- for {let i := 0} lt(i, nwords) {i := add(i, 1)} {
+ for {let i := 0} lt(i, nWords) {i := add(i, 1)} {
mstore(dest, mload(source))
source := add(source, 32)
dest := add(dest, 32)
}
// Write the last 32 bytes
- mstore(dend, last)
+ mstore(dEnd, last)
}
} else {
assembly {
// Record the total number of full words to copy
- let nwords := div(length, 32)
+ let nWords := div(length, 32)
- // We subtract 32 from `send` and `dend` because those
+ // We subtract 32 from `sEnd` and `dEnd` because those
// are the starting points when copying a word at the end.
length := sub(length, 32)
- let send := add(source, length)
- let dend := add(dest, length)
+ let sEnd := add(source, length)
+ let dEnd := add(dest, length)
// Remember the first 32 bytes of source
// This needs to be done here and not after the loop
@@ -125,10 +125,10 @@ contract LibMem
let first := mload(source)
// Copy whole words back to front
- for {let i := 0} lt(i, nwords) {i := add(i, 1)} {
- mstore(dend, mload(send))
- send := sub(send, 32)
- dend := sub(dend, 32)
+ for {let i := 0} lt(i, nWords) {i := add(i, 1)} {
+ mstore(dEnd, mload(sEnd))
+ sEnd := sub(sEnd, 32)
+ dEnd := sub(dEnd, 32)
}
// Write the first 32 bytes