init
Signed-off-by: T-Hax <>
This commit is contained in:
commit
735546619e
828 changed files with 222925 additions and 0 deletions
26
lib/v3-core/contracts/test/BitMathTest.sol
Normal file
26
lib/v3-core/contracts/test/BitMathTest.sol
Normal file
|
@ -0,0 +1,26 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity =0.7.6;
|
||||
|
||||
import '../libraries/BitMath.sol';
|
||||
|
||||
contract BitMathTest {
|
||||
function mostSignificantBit(uint256 x) external pure returns (uint8 r) {
|
||||
return BitMath.mostSignificantBit(x);
|
||||
}
|
||||
|
||||
function getGasCostOfMostSignificantBit(uint256 x) external view returns (uint256) {
|
||||
uint256 gasBefore = gasleft();
|
||||
BitMath.mostSignificantBit(x);
|
||||
return gasBefore - gasleft();
|
||||
}
|
||||
|
||||
function leastSignificantBit(uint256 x) external pure returns (uint8 r) {
|
||||
return BitMath.leastSignificantBit(x);
|
||||
}
|
||||
|
||||
function getGasCostOfLeastSignificantBit(uint256 x) external view returns (uint256) {
|
||||
uint256 gasBefore = gasleft();
|
||||
BitMath.leastSignificantBit(x);
|
||||
return gasBefore - gasleft();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue