summary refs log tree commit diff stats
path: root/lib/pure/collections
diff options
context:
space:
mode:
authorCharles Blake <cblake@csail.mit.edu>2015-02-13 14:10:09 -0500
committerCharles Blake <cblake@csail.mit.edu>2015-02-13 14:10:09 -0500
commit5068a5aa016fef0b65c7cd6af27eeeefda0e5c95 (patch)
treee47b3e2a7981599dd16e4689e92c2b53b1f11085 /lib/pure/collections
parent39b98fede3d982c8599c9ed80f1df1d56a4bcf18 (diff)
downloadNim-5068a5aa016fef0b65c7cd6af27eeeefda0e5c95.tar.gz
assignment -> shallowCopy for efficiency.
Diffstat (limited to 'lib/pure/collections')
-rw-r--r--lib/pure/collections/sets.nim2
-rw-r--r--lib/pure/collections/tables.nim2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim
index c25161ed0..4a20d00a4 100644
--- a/lib/pure/collections/sets.nim
+++ b/lib/pure/collections/sets.nim
@@ -276,7 +276,7 @@ proc excl*[A](s: var HashSet[A], key: A) =
         if isEmpty(s.data[i].hcode):   # end of collision cluster; So all done
           return
         r = s.data[i].hcode and msk    # "home" location of key@i
-      s.data[j] = s.data[i]            # data[j] will be marked EMPTY next loop
+      shallowCopy(s.data[j], s.data[i]) # data[j] will be marked EMPTY next loop
 
 proc excl*[A](s: var HashSet[A], other: HashSet[A]) =
   ## Excludes everything in `other` from `s`.
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index 58305b010..25fe306c0 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -287,7 +287,7 @@ proc del*[A, B](t: var Table[A, B], key: A) =
         if isEmpty(t.data[i].hcode):   # end of collision cluster; So all done
           return
         r = t.data[i].hcode and msk    # "home" location of key@i
-      t.data[j] = t.data[i]            # data[j] will be marked EMPTY next loop
+      shallowCopy(t.data[j], t.data[i]) # data[j] will be marked EMPTY next loop
 
 proc initTable*[A, B](initialSize=64): Table[A, B] =
   ## creates a new hash table that is empty.
behaviour' href='/andinus/pyxis/commit/pyxis.pl?id=9e70d73b5aa1397ec28702230faf4df537b3b29f'>9e70d73 ^
952fec8 ^













1f061ef ^








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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127