mirror of
https://github.com/Dev1an/MsgPack.git
synced 2026-04-27 14:57:46 +00:00
Fix Double decoding bug
This commit is contained in:
parent
1255f3c3a7
commit
068bbe87dc
2 changed files with 4 additions and 4 deletions
|
|
@ -142,8 +142,8 @@ struct MsgPckSingleValueDecodingContainer: SingleValueDecodingContainer {
|
||||||
guard decoder.storage[base] == FormatID.float64.rawValue else {
|
guard decoder.storage[base] == FormatID.float64.rawValue else {
|
||||||
throw Error.invalidFormat(decoder.storage[base])
|
throw Error.invalidFormat(decoder.storage[base])
|
||||||
}
|
}
|
||||||
let bitPattern: UInt64 = decoder.storage.read(at: base + 1)
|
let bitPattern: UInt64 = decoder.storage.bigEndianInteger(at: base + 1)
|
||||||
return .init(bitPattern)
|
return .init(bitPattern: bitPattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
func decode(_ type: String.Type) throws -> String {
|
func decode(_ type: String.Type) throws -> String {
|
||||||
|
|
|
||||||
|
|
@ -40,5 +40,5 @@ for byte in encodedGraph {
|
||||||
|
|
||||||
let decoder = Decoder()
|
let decoder = Decoder()
|
||||||
|
|
||||||
let int8 = try encoder.encode(Int8(-57))
|
let int8 = try encoder.encode(Double(-10))
|
||||||
try decoder.decode(Int8.self, from: int8)
|
try decoder.decode(Double.self, from: int8)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue