Created
May 24, 2018 03:04
-
-
Save chrisvaughn/97221f05f25519cfe29f6469f80213c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shifted_checkin = 0000100111011111, computed streak should equal 5 | |
0. starting value | |
0000100111011111 | |
1. invert (~shifted_checkin) | |
1111011000100000 | |
2. compute "shifted_checkin + 1" | |
0000100111011111 + 1 = 0000100111100000 | |
3. AND step 1 & 2 (~shifted_checkin & (shifted_checkin + 1)) | |
1111011000100000 & 0000100111100000 = 0000000000100000 = 32 | |
4. log2(32) = 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment