Skip to content

Commit

Permalink
port fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Feb 5, 2016
1 parent f6cad1b commit 84c51aa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,13 @@ public class Socket: Hashable, Equatable {
}

private class func htonsPort(port: in_port_t) -> in_port_t {

#if os(Linux)
let fixedPort = __bswap_16(port)
return fixedPort
#else
let isLittleEndian = Int(OSHostByteOrder()) == OSLittleEndian
return isLittleEndian ? _OSSwapInt16(port) : port
#endif
}
}

Expand Down

0 comments on commit 84c51aa

Please sign in to comment.