diff --git a/content/docs/milestone_2/tick-bitmap-index.md b/content/docs/milestone_2/tick-bitmap-index.md index 6435710f..cbedfce1 100644 --- a/content/docs/milestone_2/tick-bitmap-index.md +++ b/content/docs/milestone_2/tick-bitmap-index.md @@ -100,14 +100,14 @@ After finding word and bit positions, we need to make a mask. A mask is a number bit position of the tick. To find the mask, we simply calculate `2**bit_pos` (equivalent of `1 << bit_pos`): ```python mask = 2**bit_pos # or 1 << bit_pos -print(bin(mask)) -#0b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +print(format(mask, '#0258b')) ↓ here +#0b0000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ``` Next, to flip a flag, we apply the mask to the tick's word via bitwise XOR: ```python word = (2**256) - 1 # set word to all ones -print(bin(word ^ mask)) ↓ here +print(format(word ^ mask, '#0258b')) ↓ here #0b1111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 ``` @@ -116,8 +116,8 @@ You'll see that 184th bit (counting from the right starting at 0) has flipped to If a bit is zero, it'll set it to 1: ```python word = 0 -print(bin(word ^ mask)) -#0b10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +print(format(word ^ mask, '#0258b')) ↓ here +#0b0000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ``` ### Finding Next Tick