summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-11-18 09:54:12 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-11-18 09:54:12 +0100
commit7c1b5b3c2ba0e76c55cd3ea34dd1ac5beea1af42 (patch)
treecdb22eac93e2780933b233a4057c8617b4d8e3cc /lib/system
parent8875ca750f839de0c3eefdc73e665228f45b52e0 (diff)
downloadNim-7c1b5b3c2ba0e76c55cd3ea34dd1ac5beea1af42.tar.gz
fixes deepcopy regression
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/deepcopy.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/system/deepcopy.nim b/lib/system/deepcopy.nim
index 0a661d0cd..b1609252c 100644
--- a/lib/system/deepcopy.nim
+++ b/lib/system/deepcopy.nim
@@ -13,10 +13,12 @@ type
     data: array[0..0xff_ffff, (pointer, pointer)]
 
 template hashPtr(key: pointer): int = cast[int](key) shr 8
+template allocPtrTable: untyped =
+  cast[PtrTable](alloc0(sizeof(int)*2 + sizeof(pointer)*2*cap))
 
 proc rehash(t: PtrTable): PtrTable =
   let cap = (t.max+1) * 2
-  result = cast[PtrTable](alloc0(sizeof(int)*2 + sizeof(pointer)*cap))
+  result = allocPtrTable()
   result.counter = t.counter
   result.max = cap-1
   for i in 0..t.max:
@@ -29,7 +31,7 @@ proc rehash(t: PtrTable): PtrTable =
 
 proc initPtrTable(): PtrTable =
   const cap = 32
-  result = cast[PtrTable](alloc0(sizeof(int)*2 + sizeof(pointer)*cap))
+  result = allocPtrTable()
   result.counter = 0
   result.max = cap-1
 
it/build_all.bat?h=devel&id=1f1d85bb9c614d93ce38becdcc421dda00264a75'>1f1d85bb9 ^
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