Skip to content

Commit

Permalink
Remove old FixedArray implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
vishesh committed Sep 4, 2023
1 parent a67393a commit 70fcdb1
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 95 deletions.
37 changes: 37 additions & 0 deletions Sources/ARTreeModule/ARTree/FixedArray+Utils.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2023 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//

extension FixedArray {
mutating func copy(src: ArraySlice<Element>, start: Int, count: Int) {
// TODO: memcpy?
for ii in 0..<Swift.min(Self.capacity, count) {
self[ii] = src[src.startIndex + start + ii]
}
}

mutating func copy(src: UnsafeMutableBufferPointer<Element>, start: Int, count: Int) {
for ii in 0..<Swift.min(Self.capacity, count) {
self[ii] = src[start + ii]
}
}

mutating func shiftLeft(toIndex: Int) {
for ii in toIndex..<Self.capacity {
self[ii - toIndex] = self[ii]
}
}

mutating func shiftRight() {
for ii in (1..<Self.capacity).reversed() {
self[ii] = self[ii - 1]
}
}
}
75 changes: 0 additions & 75 deletions Sources/ARTreeModule/ARTree/FixedSizedArray.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Sources/ARTreeModule/ARTree/NodeHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
//
//===----------------------------------------------------------------------===//

typealias PartialBytes = FixedSizedArray8<UInt8>
typealias PartialBytes = FixedArray8<UInt8>

struct InternalNodeHeader {
var count: UInt16 = 0
var partialLength: UInt8 = 0
var partialBytes: PartialBytes = PartialBytes(val: 0)
var partialBytes: PartialBytes = PartialBytes(repeating: 0)
}
35 changes: 17 additions & 18 deletions Sources/ARTreeModule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,31 @@ See https://swift.org/LICENSE.txt for license information
#]]

add_library(ARTreeModule
"ARTree/ArtNode.swift"
"ARTree/ARTree+Sequence.swift"
"ARTree/ARTree+delete.swift"
"ARTree/ARTree+get.swift"
"ARTree/ARTree+insert.swift"
"ARTree/ARTree.swift"
"ARTree/FixedArray+impl.swift"
"ARTree/FixedSizedArray.swift"
"ARTree/Node+StringConverter.swift"
"ARTree/Node16.swift"
"ARTree/NodeHeader.swift"
"ARTree/RawNode.swift"
"ARTree/ARTree+delete.swift"
"ARTree/ARTree+Sequence.swift"
"ARTree/ArtNode.swift"
"ARTree/CMakeLists.txt"
"ARTree/Consts and Specs.swift"
"ARTree/FixedArray+Storage.swift"
"ARTree/FixedArray+Utils.swift"
"ARTree/FixedArray+impl.swift"
"ARTree/FixedArray.swift"
"ARTree/InternalNode.swift"
"ARTree/Node+UnmanagedStorage.swift"
"ARTree/Node+StringConverter.swift"
"ARTree/Node16.swift"
"ARTree/Node256.swift"
"ARTree/Node4.swift"
"ARTree/Node48.swift"
"ARTree/NodeHeader.swift"
"ARTree/NodeLeaf.swift"
"ARTree/Utils.swift"
"ARTree/ARTree+get.swift"
"ARTree/ARTree+utils.swift"
"ARTree/Consts and Specs.swift"
"ARTree/FixedArray.swift"
"ARTree/Node+Storage.swif"
"ARTree/Node4.swift"
"ARTree/Node256.swift"
"ARTree/NodeStorage.swif"
"ARTree/NodeType.swift"
"ARTree/RawNode.swift"
"ARTree/UnmanagedNodeStorage.swift"
"ARTree/Utils.swift"
)
target_link_libraries(ARTreeModule PRIVATE
_CollectionsUtilities)
Expand Down

0 comments on commit 70fcdb1

Please sign in to comment.