From 62aa8bed3b6472e8acae530f7014e7e5b0c755b5 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 19 Nov 2011 02:05:16 +0100 Subject: tester: threading tests added --- lib/pure/collections/tables.nim | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/pure/collections/tables.nim') diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim index 31b98a0cc..ccbfd9a40 100755 --- a/lib/pure/collections/tables.nim +++ b/lib/pure/collections/tables.nim @@ -127,16 +127,18 @@ template PutImpl() = else: AddImpl() -template HasKeyOrPutImpl() = - var index = RawGet(t, key) - if index >= 0: - t.data[index].val = val - result = true - else: - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) - inc(t.counter) - result = false +when false: + # not yet used: + template HasKeyOrPutImpl() = + var index = RawGet(t, key) + if index >= 0: + t.data[index].val = val + result = true + else: + if mustRehash(len(t.data), t.counter): Enlarge(t) + RawInsert(t, t.data, key, val) + inc(t.counter) + result = false proc `[]=`*[A, B](t: var TTable[A, B], key: A, val: B) = ## puts a (key, value)-pair into `t`. -- cgit 1.4.1-2-gfad0