Skip to content

Commit

Permalink
more updates for Swift 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Apr 5, 2016
1 parent f78aa65 commit a683142
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Sources/BluetoothLinux/IOCTL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ internal struct IOC {
/// ((type) << _IOC_TYPESHIFT) | \
/// ((nr) << _IOC_NRSHIFT) | \
/// ((size) << _IOC_SIZESHIFT))
static func IOC(direction: CUnsignedInt, _ type: CInt, _ nr: CInt, _ size: CInt) -> CInt {
static func IOC(direction: CUnsignedInt, _ type: CInt, _ nr: CInt, _ size: CInt) -> CUnsignedLong {

let dir = CInt(direction)

return (((dir) << DIRSHIFT) | ((type) << TYPESHIFT) | ((nr) << NRSHIFT) | ((size) << SIZESHIFT))
return CUnsignedLong(bitPattern: CLong(((dir) << DIRSHIFT) | ((type) << TYPESHIFT) | ((nr) << NRSHIFT) | ((size) << SIZESHIFT)))
}

@inline(__always)
static func IOW<T>(type: CInt, _ nr: CInt, _ size: T.Type) -> CInt {
static func IOW<T>(type: CInt, _ nr: CInt, _ size: T.Type) -> CUnsignedLong {

return IOC(WRITE, type, nr, TYPECHECK(size))
}

@inline(__always)
static func IOR<T>(type: CInt, _ nr: CInt, _ size: T.Type) -> CInt {
static func IOR<T>(type: CInt, _ nr: CInt, _ size: T.Type) -> CUnsignedLong {

return IOC(READ, type, nr, TYPECHECK(size))
}
Expand All @@ -78,9 +78,7 @@ internal struct IOC {
// MARK: - Darwin Stubs

#if os(OSX) || os(iOS)

func ioctl(d: CInt, _ request: UInt, _ varargs: Any...) -> CInt { stub() }

func swift_bluetooth_ioctl(d: CInt, _ command: CInt, _ pointer: UnsafeMutablePointer<Void>) -> CInt { stub() }

func swift_bluetooth_ioctl(fd: Int32, _ request: UInt, _ pointer: UnsafeMutablePointer<Void>) -> CInt { stub() }

#endif
2 changes: 1 addition & 1 deletion Sources/UnitTests/MathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

for (index, swiftDefinition) in swiftDefinitionList.enumerated() {

let cDefinition = cListPointer[index]
let cDefinition = CUnsignedLong(bitPattern: CLong(cListPointer[index]))

guard swiftDefinition == cDefinition else {

Expand Down

0 comments on commit a683142

Please sign in to comment.