Comparing version 0.3.1 to 0.3.2
@@ -104,2 +104,5 @@ "use strict" | ||
case 0x19: | ||
if (majorType == 7) { | ||
return getFloat16() | ||
} | ||
token = dataView.getUint16(position) | ||
@@ -528,2 +531,15 @@ position += 2 | ||
} | ||
function getFloat16() { | ||
let byte0 = src[position++] | ||
let byte1 = src[position++] | ||
let half = (byte0 << 8) + byte1 | ||
let exp = (half >> 10) & 0x1f | ||
let mant = half & 0x3ff | ||
let val | ||
if (exp == 0) val = Math.exp(mant, -24) | ||
else if (exp != 31) val = Math.exp(mant + 1024, exp - 25) | ||
else val = mant == 0 ? Infinity : NaN | ||
return half & 0x8000 ? -val : val | ||
} | ||
let glbl = typeof window == 'object' ? window : global | ||
@@ -530,0 +546,0 @@ |
@@ -620,10 +620,2 @@ "use strict" | ||
let { target, position, targetView } = allocateForWrite(1) | ||
/*if (length < 0x100) { | ||
target[position++] = 0xc7 | ||
target[position++] = length | ||
} else if (length < 0x10000) { | ||
target[position++] = 0xc8 | ||
target[position++] = length >> 8 | ||
target[position++] = length & 0xff | ||
} else {*/ | ||
target[position++] = 0xcc | ||
@@ -630,0 +622,0 @@ encode([type, hasNodeBuffer ? Buffer.from(buffer, offset, length) : |
{ | ||
"name": "cbor-x", | ||
"author": "Kris Zyp", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "types": "./index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124494
2731