Use new binarySearch everywhere (#7876)

This commit is contained in:
Dmitry Atamanov 2018-05-25 00:04:30 +03:00 • committed by GitHub
commit e206a8d952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 68 deletions

View file

@ -576,18 +576,3 @@ proc nimBoolToStr(x: bool): string {.compilerRtl.} =
proc nimCharToStr(x: char): string {.compilerRtl.} =
result = newString(1)
result[0] = x
proc binaryStrSearch(x: openArray[string], y: string): int {.compilerproc.} =
var
a = 0
b = len(x)
while a < b:
var mid = (a + b) div 2
if x[mid] < y:
a = mid + 1
else:
b = mid
if a < len(x) and x[a] == y:
result = a
else:
result = -1