Why nextInitializedTickWithinOneWord() returns the same tick provided when there are other initialized ticks to the right. #93
Replies: 1 comment
-
|
it works as expected after making changes in creating mask for selling eth or x 'mask = (1 << bitPos) - 1 + (1 << bitPos); ---> (1 << bitPos)-1' bit = ^(1<<184) = mask = (1<<184)-1 = so now we can search the next initialized tick in other 184 digits without including 185th digit (184). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
ticks intialized 85176,85177,85175
(111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ).
when calling NextInitializedTick with values 85176 ,1 . It returns 85176 while the next initialized tick is 85175.
In the low level,
mask = 49039857307708443467467104868809893875799651909875269631 =
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 (185 digits)
flipped 85175,85176,85177
bit =85819750288489776068067433520417314282649390842281721856 =
111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (186 digits)
masked = bit & mask =36779892980781332600600328651607420406849738932406452224 =
11000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (185 digits)
when the masked value is passed to the mostSignificantBit(masked) it returns the 184 which is 85176.
i don't understand that we are searching next initialized tick to right side of 184(85176) but it returns the same provided tick back. But returns 85175 when calling nextInitializedTickWithinOneWord( 85176,1 ) without initializing 85176 while 85175 is initialized.
mapping(int16 => uint256) public self;
Beta Was this translation helpful? Give feedback.
All reactions