Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support OpenBSD. #52

Merged
merged 3 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/DequeModule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_library(DequeModule
_DequeBufferHeader.swift
_DequeSlot.swift
_UnsafeWrappedBuffer.swift
Compatibility.swift
Deque._Storage.swift
Deque._UnsafeHandle.swift
Deque.swift
Expand Down
9 changes: 7 additions & 2 deletions Sources/DequeModule/Deque._Storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ extension Deque._Storage {
internal init(minimumCapacity: Int) {
let object = _DequeBuffer<Element>.create(
minimumCapacity: minimumCapacity,
makingHeaderWith: { object in
_DequeBufferHeader(capacity: object.capacity, count: 0, startSlot: .zero)
makingHeaderWith: {
#if os(OpenBSD)
let capacity = minimumCapacity
#else
let capacity = $0.capacity
#endif
return _DequeBufferHeader(capacity: capacity, count: 0, startSlot: .zero)
})
self.init(_buffer: _Buffer(unsafeBufferObject: object))
}
Expand Down
18 changes: 14 additions & 4 deletions Sources/DequeModule/Deque._UnsafeHandle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,13 @@ extension Deque._UnsafeHandle {
let object = _DequeBuffer<Element>.create(
minimumCapacity: minimumCapacity,
makingHeaderWith: {
_DequeBufferHeader(
capacity: $0.capacity,
#if os(OpenBSD)
let capacity = minimumCapacity
#else
let capacity = $0.capacity
#endif
return _DequeBufferHeader(
capacity: capacity,
count: count,
startSlot: .zero)
})
Expand Down Expand Up @@ -327,8 +332,13 @@ extension Deque._UnsafeHandle {
let object = _DequeBuffer<Element>.create(
minimumCapacity: minimumCapacity,
makingHeaderWith: {
_DequeBufferHeader(
capacity: $0.capacity,
#if os(OpenBSD)
let capacity = minimumCapacity
#else
let capacity = $0.capacity
#endif
return _DequeBufferHeader(
capacity: capacity,
count: count,
startSlot: .zero)
})
Expand Down
2 changes: 2 additions & 0 deletions cmake/modules/SwiftSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ function(get_swift_host_arch result_var_name)
set("${result_var_name}" "armv7" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7-a")
set("${result_var_name}" "armv7" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64")
set("${result_var_name}" "amd64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
set("${result_var_name}" "x86_64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
Expand Down