Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
a9fc7310
Unverified
Commit
a9fc7310
authored
Sep 24, 2021
by
elenadimitrova
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make RLP libraries unchecked regions consistent
parent
73e080c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
Lib_RLPReader.sol
packages/contracts/contracts/libraries/rlp/Lib_RLPReader.sol
+12
-11
Lib_RLPWriter.sol
packages/contracts/contracts/libraries/rlp/Lib_RLPWriter.sol
+7
-6
No files found.
packages/contracts/contracts/libraries/rlp/Lib_RLPReader.sol
View file @
a9fc7310
...
...
@@ -592,8 +592,11 @@ library Lib_RLPReader {
}
// Pick out the remaining bytes.
uint256 mask;
unchecked {
uint256 mask = 256 ** (32 - (_length % 32)) - 1;
mask = 256 ** (32 - (_length % 32)) - 1;
}
assembly {
mstore(
dest,
...
...
@@ -603,10 +606,8 @@ library Lib_RLPReader {
)
)
}
return out;
}
}
/**
* Copies an RLP item into bytes.
...
...
packages/contracts/contracts/libraries/rlp/Lib_RLPWriter.sol
View file @
a9fc7310
...
...
@@ -227,15 +227,16 @@ library Lib_RLPWriter {
src += 32;
}
uint256 mask;
unchecked {
uint256 mask = 256 ** (32 - len) - 1;
mask = 256 ** (32 - len) - 1;
}
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
}
/**
* Flattens a list of byte strings into one byte string.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment