Skip to content

Commit 9530141

Browse files
committed
Fix for SFloats
1 parent 704f90f commit 9530141

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

DataDecoder.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'DataDecoder'
11-
s.version = '0.6.3'
11+
s.version = '0.7.0'
1212
s.summary = 'Swift Data Decoder. Easily Decode Data values'
1313

1414
s.description = <<-DESC

Sources/DataDecoder/DataDecoder.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ public extension DataDecoder {
255255
///
256256
/// - Returns: Float value
257257
public mutating func decodeSFloatValue() -> Float {
258-
let tmpValue = decode.scanValue(index: &index, type: UInt16.self) ?? 0
258+
let tmpValue = decode.scanValue(index: &index, type: Int16.self) ?? 0
259259
var mantissa = Int16(tmpValue & 0x0FFF)
260-
let exponent = UInt8(tmpValue >> 12)
260+
let exponent = Int8(tmpValue >> 12)
261261

262262
var returnResult: Float = 0
263263

@@ -282,9 +282,9 @@ public extension DataDecoder {
282282
///
283283
/// - Returns: Float value
284284
public mutating func decodeFloatValue() -> Float {
285-
let tmpValue = decode.scanValue(index: &index, type: UInt32.self) ?? 0
285+
let tmpValue = decode.scanValue(index: &index, type: Int32.self) ?? 0
286286
var mantissa = Int32(tmpValue & 0x00FFFFFF)
287-
let exponent = UInt8(tmpValue >> 24)
287+
let exponent = Int8(tmpValue >> 24)
288288

289289
var returnResult: Float = 0
290290

0 commit comments

Comments
 (0)