Skip to content

Commit 26d673f

Browse files
authored
Merge pull request #53 from litso/xcode-9-build-errors
Fix XCode9 build errors when casting to Int
2 parents 24874d2 + 5637bdb commit 26d673f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/MessagePack/Pack.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func packPositiveInteger(_ value: UInt64) -> Data {
2626
return Data([0xcc, UInt8(truncatingBitPattern: value)])
2727
} else if value <= 0xffff {
2828
return Data([0xcd]) + packInteger(value, parts: 2)
29-
} else if value <= 0xffff_ffff {
29+
} else if value <= 0xffff_ffff as UInt64 {
3030
return Data([0xce]) + packInteger(value, parts: 4)
3131
} else {
3232
return Data([0xcf]) + packInteger(value, parts: 8)
@@ -88,7 +88,7 @@ public func pack(_ value: MessagePackValue) -> Data {
8888
case .string(let string):
8989
let utf8 = string.utf8
9090
let count = UInt32(utf8.count)
91-
precondition(count <= 0xffff_ffff)
91+
precondition(count <= 0xffff_ffff as UInt32)
9292

9393
let prefix: Data
9494
if count <= 0x19 {
@@ -105,7 +105,7 @@ public func pack(_ value: MessagePackValue) -> Data {
105105

106106
case .binary(let data):
107107
let count = UInt32(data.count)
108-
precondition(count <= 0xffff_ffff)
108+
precondition(count <= 0xffff_ffff as UInt32)
109109

110110
let prefix: Data
111111
if count <= 0xff {
@@ -120,7 +120,7 @@ public func pack(_ value: MessagePackValue) -> Data {
120120

121121
case .array(let array):
122122
let count = UInt32(array.count)
123-
precondition(count <= 0xffff_ffff)
123+
precondition(count <= 0xffff_ffff as UInt32)
124124

125125
let prefix: Data
126126
if count <= 0xe {
@@ -150,7 +150,7 @@ public func pack(_ value: MessagePackValue) -> Data {
150150

151151
case .extended(let type, let data):
152152
let count = UInt32(data.count)
153-
precondition(count <= 0xffff_ffff)
153+
precondition(count <= 0xffff_ffff as UInt32)
154154

155155
let unsignedType = UInt8(bitPattern: type)
156156
var prefix: Data

0 commit comments

Comments
 (0)