From df40fcdde896f636a05d1e3fe598feb2a816f2b9 Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 13 Dec 2023 13:29:42 +0100 Subject: break up twtstr somewhat Avoid computing e.g. charwidth data for http which does not need it at all. --- src/utils/map.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/utils/map.nim') diff --git a/src/utils/map.nim b/src/utils/map.nim index 526b9154..2a3515a1 100644 --- a/src/utils/map.nim +++ b/src/utils/map.nim @@ -1,15 +1,15 @@ import algorithm -func searchInMap*[U, T](a: openarray[(U, T)], u: U): int = +func searchInMap*[U, T](a: openArray[(U, T)], u: U): int = when not (typeof(u) is U): if c > cast[typeof(c)](high(U)): return -1 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 = +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 = +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 -- cgit 1.4.1-2-gfad0 ware → More resilient society.Kartik K. Agaram <vc@akkartik.com>
about summary refs log tree commit diff stats
path: root/302stack_allocate.subx
blob: 4634039d627debde1aae04cbda28819dc160f093 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61