diff --git a/MsgPack/Decoder.swift b/MsgPack/Decoder.swift index f7ae951..48bb657 100644 --- a/MsgPack/Decoder.swift +++ b/MsgPack/Decoder.swift @@ -142,8 +142,8 @@ struct MsgPckSingleValueDecodingContainer: SingleValueDecodingContainer { guard decoder.storage[base] == FormatID.float64.rawValue else { throw Error.invalidFormat(decoder.storage[base]) } - let bitPattern: UInt64 = decoder.storage.read(at: base + 1) - return .init(bitPattern) + let bitPattern: UInt64 = decoder.storage.bigEndianInteger(at: base + 1) + return .init(bitPattern: bitPattern) } func decode(_ type: String.Type) throws -> String { diff --git a/Playground.playground/Contents.swift b/Playground.playground/Contents.swift index 38e5849..b0cae1d 100644 --- a/Playground.playground/Contents.swift +++ b/Playground.playground/Contents.swift @@ -40,5 +40,5 @@ for byte in encodedGraph { let decoder = Decoder() -let int8 = try encoder.encode(Int8(-57)) -try decoder.decode(Int8.self, from: int8) +let int8 = try encoder.encode(Double(-10)) +try decoder.decode(Double.self, from: int8)