From 84a47155fb58d4e6a74f7dc5b0976407e745e174 Mon Sep 17 00:00:00 2001 From: Michael Steindorfer Date: Tue, 22 Jun 2021 11:37:30 +0200 Subject: [PATCH] [Capsule] Name correctly usages of `trieRange` --- Sources/Capsule/_BitmapIndexedMapNode.swift | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Sources/Capsule/_BitmapIndexedMapNode.swift b/Sources/Capsule/_BitmapIndexedMapNode.swift index e0ed0806..2c48d14d 100644 --- a/Sources/Capsule/_BitmapIndexedMapNode.swift +++ b/Sources/Capsule/_BitmapIndexedMapNode.swift @@ -112,7 +112,7 @@ final class BitmapIndexedMapNode: ManagedBuffer, Ma static func create(dataMap: Bitmap, firstKey: Key, firstValue: Value) -> Self { let result = Self.create(minimumCapacity: fixedTrieCapacity + initialDataCapacity) { _ in Header(bitmap1: dataMap, bitmap2: 0) } as! Self - result.withUnsafeMutablePointerRanges { dataRange, nodeRange in + result.withUnsafeMutablePointerRanges { dataRange, _ in dataRange.startIndex.initialize(to: (firstKey, firstValue)) } return result @@ -120,7 +120,7 @@ final class BitmapIndexedMapNode: ManagedBuffer, Ma static func create(dataMap: Bitmap, firstKey: Key, firstValue: Value, secondKey: Key, secondValue: Value) -> Self { let result = Self.create(minimumCapacity: fixedTrieCapacity + initialDataCapacity) { _ in Header(bitmap1: dataMap, bitmap2: 0) } as! Self - result.withUnsafeMutablePointerRanges { dataRange, nodeRange in + result.withUnsafeMutablePointerRanges { dataRange, _ in dataRange.startIndex.initialize(to: (firstKey, firstValue)) dataRange.startIndex.successor().initialize(to: (secondKey, secondValue)) } @@ -129,25 +129,25 @@ final class BitmapIndexedMapNode: ManagedBuffer, Ma static func create(nodeMap: Bitmap, firstNode: BitmapIndexedMapNode) -> Self { let result = Self.create(minimumCapacity: fixedTrieCapacity + initialDataCapacity) { _ in Header(bitmap1: 0, bitmap2: nodeMap) } as! Self - result.withUnsafeMutablePointerRanges { dataRange, nodeRange in - nodeRange.startIndex.initialize(to: firstNode) + result.withUnsafeMutablePointerRanges { _, trieRange in + trieRange.startIndex.initialize(to: firstNode) } return result } static func create(collMap: Bitmap, firstNode: HashCollisionMapNode) -> Self { let result = Self.create(minimumCapacity: fixedTrieCapacity + initialDataCapacity) { _ in Header(bitmap1: collMap, bitmap2: collMap) } as! Self - result.withUnsafeMutablePointerRanges { dataRange, nodeRange in - nodeRange.startIndex.initialize(to: firstNode) + result.withUnsafeMutablePointerRanges { _, trieRange in + trieRange.startIndex.initialize(to: firstNode) } return result } static func create(dataMap: Bitmap, collMap: Bitmap, firstKey: Key, firstValue: Value, firstNode: HashCollisionMapNode) -> Self { let result = Self.create(minimumCapacity: fixedTrieCapacity + initialDataCapacity) { _ in Header(bitmap1: dataMap | collMap, bitmap2: collMap) } as! Self - result.withUnsafeMutablePointerRanges { dataRange, nodeRange in + result.withUnsafeMutablePointerRanges { dataRange, trieRange in dataRange.startIndex.initialize(to: (firstKey, firstValue)) - nodeRange.startIndex.initialize(to: firstNode) + trieRange.startIndex.initialize(to: firstNode) } return result } @@ -414,8 +414,8 @@ final class BitmapIndexedMapNode: ManagedBuffer, Ma var bitmapIndexedNodeArity: Int { nodeMap.nonzeroBitCount } func getBitmapIndexedNode(_ index: Int) -> BitmapIndexedMapNode { - self.withUnsafeMutablePointerRanges { _, nodeRange in - nodeRange.startIndex[index] as! BitmapIndexedMapNode + self.withUnsafeMutablePointerRanges { _, trieRange in + trieRange.startIndex[index] as! BitmapIndexedMapNode } } @@ -442,8 +442,8 @@ final class BitmapIndexedMapNode: ManagedBuffer, Ma var hashCollisionNodeArity: Int { collMap.nonzeroBitCount } func getHashCollisionNode(_ index: Int) -> HashCollisionMapNode { - self.withUnsafeMutablePointerRanges { _, nodeRange in - nodeRange.startIndex[bitmapIndexedNodeArity + index] as! HashCollisionMapNode + self.withUnsafeMutablePointerRanges { _, trieRange in + trieRange.startIndex[bitmapIndexedNodeArity + index] as! HashCollisionMapNode } } @@ -521,8 +521,8 @@ final class BitmapIndexedMapNode: ManagedBuffer, Ma dst = src.copy() } - dst.withUnsafeMutablePointerRanges { _, nodeRange in - nodeRange.startIndex[idx] = newNode as AnyObject + dst.withUnsafeMutablePointerRanges { _, trieRange in + trieRange.startIndex[idx] = newNode as AnyObject } assert(dst.contentInvariant)