From 5e50ccdcf679c9a6b7a73a47ac5346c502bdb4e2 Mon Sep 17 00:00:00 2001 From: Michael Steindorfer Date: Sat, 5 Jun 2021 10:11:00 +0200 Subject: [PATCH] [Capsule] Turn some preconditions into asserts --- Sources/Capsule/_BitmapIndexedMapNode.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Capsule/_BitmapIndexedMapNode.swift b/Sources/Capsule/_BitmapIndexedMapNode.swift index 07c301ce..03dc58ea 100644 --- a/Sources/Capsule/_BitmapIndexedMapNode.swift +++ b/Sources/Capsule/_BitmapIndexedMapNode.swift @@ -200,7 +200,7 @@ final class BitmapIndexedMapNode: MapNode where Key: Hashable { preconditionFailure("Sub-node must have at least one element.") case .sizeOne: - precondition(self.bitmapIndexedNodeArity >= 1) + assert(self.bitmapIndexedNodeArity >= 1) if self.isCandiateForCompaction { // escalate singleton @@ -211,7 +211,7 @@ final class BitmapIndexedMapNode: MapNode where Key: Hashable { } case .sizeMoreThanOne: - precondition(self.bitmapIndexedNodeArity >= 1) + assert(self.bitmapIndexedNodeArity >= 1) if (subNodeNew.isWrappingSingleHashCollisionNode) { if self.isCandiateForCompaction { @@ -266,7 +266,7 @@ final class BitmapIndexedMapNode: MapNode where Key: Hashable { var isWrappingSingleHashCollisionNode: Bool { payloadArity == 0 && bitmapIndexedNodeArity == 0 && hashCollisionNodeArity == 1 } func mergeTwoKeyValPairs(_ key0: Key, _ value0: Value, _ keyHash0: Int, _ key1: Key, _ value1: Value, _ keyHash1: Int, _ shift: Int) -> BitmapIndexedMapNode { - precondition(keyHash0 != keyHash1) + assert(keyHash0 != keyHash1) let mask0 = maskFrom(keyHash0, shift) let mask1 = maskFrom(keyHash1, shift) @@ -287,7 +287,7 @@ final class BitmapIndexedMapNode: MapNode where Key: Hashable { } func mergeKeyValPairAndCollisionNode(_ key0: Key, _ value0: Value, _ keyHash0: Int, _ node1: HashCollisionMapNode, _ nodeHash1: Int, _ shift: Int) -> BitmapIndexedMapNode { - precondition(keyHash0 != nodeHash1) + assert(keyHash0 != nodeHash1) let mask0 = maskFrom(keyHash0, shift) let mask1 = maskFrom(nodeHash1, shift)