From 946ffe0a4ad0981b795e2e13d42b935cfe3a1e09 Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Tue, 15 Aug 2023 14:48:41 +0200 Subject: [PATCH] arc/orc lacks `shallowCopy` --> use `move` (#630) `shallowCopy` is not available in `--mm:arc/orc`, but our usage can be replaced with `move`. --- eth/p2p/discoveryv5/routing_table.nim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/eth/p2p/discoveryv5/routing_table.nim b/eth/p2p/discoveryv5/routing_table.nim index 89cb183f..a3876e76 100644 --- a/eth/p2p/discoveryv5/routing_table.nim +++ b/eth/p2p/discoveryv5/routing_table.nim @@ -485,10 +485,16 @@ func len*(r: RoutingTable): int = func moveRight[T](arr: var openArray[T], a, b: int) = ## In `arr` move elements in range [a, b] right by 1. var t: T - shallowCopy(t, arr[b + 1]) - for i in countdown(b, a): - shallowCopy(arr[i + 1], arr[i]) - shallowCopy(arr[a], t) + when declared(shallowCopy): + shallowCopy(t, arr[b + 1]) + for i in countdown(b, a): + shallowCopy(arr[i + 1], arr[i]) + shallowCopy(arr[a], t) + else: + t = move arr[b + 1] + for i in countdown(b, a): + arr[i + 1] = move arr[i] + arr[a] = move t proc setJustSeen*(r: RoutingTable, n: Node) = ## Move `n` to the head (most recently seen) of its bucket.