mirror of
https://github.com/apple/swift-collections
synced 2026-11-29 05:14:20 +00:00
[Capsule] Make alignment calculation robust
This commit is contained in:
1 parent
d295c30459
commit
2856197785
1 file changed
+1
-1
@@ -56,7 +56,7 @@ final class BitmapIndexedMapNode<Key, Value>: MapNode where Key: Hashable {
|
||||
|
||||
let memory = UnsafeMutableRawPointer.allocate(
|
||||
byteCount: dataCapacityInBytes + trieCapacityInBytes,
|
||||
alignment: 8)
|
||||
alignment: Swift.max(MemoryLayout<DataBufferElement>.alignment, MemoryLayout<TrieBufferElement>.alignment))
|
||||
|
||||
let dataBaseAddress = memory.advanced(by: trieCapacityInBytes).bindMemory(to: DataBufferElement.self, capacity: dataCapacity)
|
||||
let trieBaseAddress = memory.bindMemory(to: TrieBufferElement.self, capacity: trieCapacity)
|
||||
|
||||
Reference in new issue
Block a user