Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
俞永鹏
openzeppelin-contracts-upgradeable
Commits
dbf45c47
Commit
dbf45c47
authored
Jul 30, 2021
by
github-actions
Browse files
Options
Browse Files
Download
Plain Diff
Merge upstream openzeppelin-contracts into upstream-patched
parents
8702a099
3dadd400
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
BitMaps.sol
contracts/utils/structs/BitMaps.sol
+6
-6
No files found.
contracts/utils/structs/BitMaps.sol
View file @
dbf45c47
...
@@ -14,8 +14,8 @@ library BitMaps {
...
@@ -14,8 +14,8 @@ library BitMaps {
* @dev Returns whether the bit at `index` is set.
* @dev Returns whether the bit at `index` is set.
*/
*/
function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
uint256 bucket = index
/ 256
;
uint256 bucket = index
>> 8
;
uint256 mask = 1 << (index
% 256
);
uint256 mask = 1 << (index
& 0xff
);
return bitmap._data[bucket] & mask != 0;
return bitmap._data[bucket] & mask != 0;
}
}
...
@@ -38,8 +38,8 @@ library BitMaps {
...
@@ -38,8 +38,8 @@ library BitMaps {
* @dev Sets the bit at `index`.
* @dev Sets the bit at `index`.
*/
*/
function set(BitMap storage bitmap, uint256 index) internal {
function set(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index
/ 256
;
uint256 bucket = index
>> 8
;
uint256 mask = 1 << (index
% 256
);
uint256 mask = 1 << (index
& 0xff
);
bitmap._data[bucket] |= mask;
bitmap._data[bucket] |= mask;
}
}
...
@@ -47,8 +47,8 @@ library BitMaps {
...
@@ -47,8 +47,8 @@ library BitMaps {
* @dev Unsets the bit at `index`.
* @dev Unsets the bit at `index`.
*/
*/
function unset(BitMap storage bitmap, uint256 index) internal {
function unset(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index
/ 256
;
uint256 bucket = index
>> 8
;
uint256 mask = 1 << (index
% 256
);
uint256 mask = 1 << (index
& 0xff
);
bitmap._data[bucket] &= ~mask;
bitmap._data[bucket] &= ~mask;
}
}
}
}
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