From 285619778532f9c0e623c7ceed3b68cd0cebf242 Mon Sep 17 00:00:00 2001 From: Michael Steindorfer Date: Wed, 1 Dec 2021 13:07:25 +0100 Subject: [PATCH] [Capsule] Make alignment calculation robust --- Sources/Capsule/_BitmapIndexedMapNode.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Capsule/_BitmapIndexedMapNode.swift b/Sources/Capsule/_BitmapIndexedMapNode.swift index 1d83c13b..15116ca2 100644 --- a/Sources/Capsule/_BitmapIndexedMapNode.swift +++ b/Sources/Capsule/_BitmapIndexedMapNode.swift @@ -56,7 +56,7 @@ final class BitmapIndexedMapNode: MapNode where Key: Hashable { let memory = UnsafeMutableRawPointer.allocate( byteCount: dataCapacityInBytes + trieCapacityInBytes, - alignment: 8) + alignment: Swift.max(MemoryLayout.alignment, MemoryLayout.alignment)) let dataBaseAddress = memory.advanced(by: trieCapacityInBytes).bindMemory(to: DataBufferElement.self, capacity: dataCapacity) let trieBaseAddress = memory.bindMemory(to: TrieBufferElement.self, capacity: trieCapacity)