about summary refs log tree commit diff stats
path: root/js/magic-bird/imgs/extracted-1688-map/MapParts/hills/147.png
Commit message (Collapse)AuthorAgeFilesLines
* *elioat2024-01-151-0/+0
ef='/ahoang/chawan/blame/src/utils/map.nim?id=1dd9eba6aba9760339fbef9bbd4244108fac2eab'>^
df40fcdd ^
19068fd7 ^

df40fcdd ^
19068fd7 ^
a3b2d918 ^
19068fd7 ^
a3b2d918 ^

19068fd7 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
                    
 
                                                          

                                                               
                                                       

                        
                                                      
                                                           
                
       

                  



                  
import std/algorithm

func searchInMap*[U, T](a: openArray[(U, T)], u: U): int =
  binarySearch(a, u, proc(x: (U, T), y: U): int = cmp(x[0], y))

func isInMap*[U, T](a: openArray[(U, T)], u: U): bool =
  a.searchInMap(u) != -1

func isInRange*[U](a: openArray[(U, U)], u: U): bool =
  let res = binarySearch(a, u, proc(x: (U, U), y: U): int =
    if x[0] > y:
      1
    elif x[1] < y:
      -1
    else:
      0
  )
  return res != -1