Created
May 20, 2017 09:08
-
-
Save fulmicoton/08327751d925e591da541817009dc4d8 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
| let start = 0; | |
| let end = NUM_DOCS_PER_BLOCK; | |
| let mut half = NUM_DOCS_PER_BLOCK / 2; | |
| for _ in 0..7 { | |
| let mid = start + half; | |
| let doc = block_docs[mid]; | |
| let cmp = (doc > target); | |
| (start, end) = | |
| if (doc <= target) { | |
| (mid, end) | |
| } | |
| else { | |
| (start, mid) | |
| }; | |
| half /= 2; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment