made more tests green; fixes #201

This commit is contained in:
Araq 2012-09-12 21:48:37 +02:00
commit a59abdf8e4
13 changed files with 43 additions and 30 deletions

View file

@ -66,12 +66,12 @@ proc setItem[T,D] (AKey: T, AValue: D, ANode: PNode[T,D]): ref TItem[T,D] {.inli
proc cmp[T:Int8|Int16|Int32|Int64|Int] (a,b: T): T {.inline.} =
return a-b
template binSearchImpl *(docmp: expr) =
template binSearchImpl *(docmp: expr) {.immediate.} =
var bFound = false
result = 0
var H = haystack.len -1
while result <= H :
var I = (result + H) shr 1
var I {.inject.} = (result + H) shr 1
var SW = docmp
if SW < 0: result = I + 1
else: