From d0930b90485703937d8d7364cc4c27f7a7de4556 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 11 Apr 2018 16:39:46 -0700 Subject: Improved readability of FillOrderNoThrow II --- .../protocol/Exchange/MixinWrapperFunctions.sol | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol index a440593ee..d4e4d453b 100644 --- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol +++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol @@ -134,9 +134,9 @@ contract MixinWrapperFunctions is // Offset from the source data we're reading from let sourceOffset := order - // bytesLen and bytesLenPadded track the length of a dynamically-allocated bytes array. - let bytesLen := 0 - let bytesLenPadded := 0 + // arrayLenBytes and arrayLenWords track the length of a dynamically-allocated bytes array. + let arrayLenBytes := 0 + let arrayLenWords := 0 /////// Write order Struct /////// // Write memory location of Order, relative to the start of the @@ -155,16 +155,16 @@ contract MixinWrapperFunctions is mstore(add(dataAreaStart, mul(11, 0x20)), sub(dataAreaEnd, dataAreaStart)) // Calculate length of - bytesLen := mload(sourceOffset) + arrayLenBytes := mload(sourceOffset) sourceOffset := add(sourceOffset, 0x20) - bytesLenPadded := div(add(bytesLen, 0x1F), 0x20) + arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20) // Write length of - mstore(dataAreaEnd, bytesLen) + mstore(dataAreaEnd, arrayLenBytes) dataAreaEnd := add(dataAreaEnd, 0x20) // Write contents of - for {let i := 0} lt(i, bytesLenPadded) {i := add(i, 1)} { + for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} { mstore(dataAreaEnd, mload(sourceOffset)) dataAreaEnd := add(dataAreaEnd, 0x20) sourceOffset := add(sourceOffset, 0x20) @@ -174,16 +174,16 @@ contract MixinWrapperFunctions is mstore(add(dataAreaStart, mul(12, 0x20)), sub(dataAreaEnd, dataAreaStart)) // Calculate length of - bytesLen := mload(sourceOffset) + arrayLenBytes := mload(sourceOffset) sourceOffset := add(sourceOffset, 0x20) - bytesLenPadded := div(add(bytesLen, 0x1F), 0x20) + arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20) // Write length of - mstore(dataAreaEnd, bytesLen) + mstore(dataAreaEnd, arrayLenBytes) dataAreaEnd := add(dataAreaEnd, 0x20) // Write contents of - for {let i := 0} lt(i, bytesLenPadded) {i := add(i, 1)} { + for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} { mstore(dataAreaEnd, mload(sourceOffset)) dataAreaEnd := add(dataAreaEnd, 0x20) sourceOffset := add(sourceOffset, 0x20) @@ -199,16 +199,16 @@ contract MixinWrapperFunctions is // Calculate length of signature sourceOffset := signature - bytesLen := mload(sourceOffset) + arrayLenBytes := mload(sourceOffset) sourceOffset := add(sourceOffset, 0x20) - bytesLenPadded := div(add(bytesLen, 0x1F), 0x20) + arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20) // Write length of signature - mstore(dataAreaEnd, bytesLen) + mstore(dataAreaEnd, arrayLenBytes) dataAreaEnd := add(dataAreaEnd, 0x20) // Write contents of signature - for {let i := 0} lt(i, bytesLenPadded) {i := add(i, 1)} { + for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} { mstore(dataAreaEnd, mload(sourceOffset)) dataAreaEnd := add(dataAreaEnd, 0x20) sourceOffset := add(sourceOffset, 0x20) -- cgit v1.2.3