node-opcua-basic-types
Advanced tools
Comparing version 2.71.0 to 2.72.1
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export declare enum AttributeIds { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /*** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /*** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /*** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /*** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -163,2 +163,6 @@ "use strict"; | ||
function constructInt64(high, low) { | ||
if (high === 0 && low < 0) { | ||
high = 0xffffffff; | ||
low = 0xffffffff + low + 1; | ||
} | ||
(0, node_opcua_assert_1.assert)(low >= 0 && low <= 0xffffffff); | ||
@@ -183,4 +187,16 @@ (0, node_opcua_assert_1.assert)(high >= 0 && high <= 0xffffffff); | ||
v = value.split(","); | ||
high = parseInt(v[0], 10); | ||
low = parseInt(v[1], 10); | ||
if (v.length === 1) { | ||
// was a single string, good news ! BigInt can be used with nodejs >=12 | ||
let a = BigInt(value); | ||
if (a < BigInt(0)) { | ||
const mask = BigInt("0xFFFFFFFFFFFFFFFF"); | ||
a = (mask + a + BigInt(1)) & mask; | ||
} | ||
high = Number(a >> BigInt(32)); | ||
low = Number(a & BigInt(0xffffffff)); | ||
} | ||
else { | ||
high = parseInt(v[0], 10); | ||
low = parseInt(v[1], 10); | ||
} | ||
return constructInt64(high, low); | ||
@@ -187,0 +203,0 @@ } |
@@ -0,0 +0,0 @@ /*** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream"; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function roundToFloat2(float: number): number; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /*** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /*** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /*** |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "node-opcua-basic-types", | ||
"version": "2.71.0", | ||
"version": "2.72.1", | ||
"description": "pure nodejs OPCUA SDK - module -basic-types", | ||
@@ -45,3 +45,3 @@ "main": "./dist/index.js", | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "10f7cc1e1cd30dfef75adad9cb709a78401fabf3" | ||
"gitHead": "ba98dd91a9eada9815268c66c98ca5391bc884e7" | ||
} |
@@ -158,3 +158,3 @@ /*** | ||
export function encodeUInt64(value: UInt64 | number, stream: OutputBinaryStream): void { | ||
export function encodeUInt64(value: UInt64 | number, stream: OutputBinaryStream): void { | ||
if (typeof value === "number") { | ||
@@ -177,2 +177,6 @@ const arr = coerceUInt64(value); | ||
export function constructInt64(high: UInt32, low: UInt32): Int64 { | ||
if (high === 0 && low < 0) { | ||
high = 0xffffffff; | ||
low = 0xffffffff + low + 1; | ||
} | ||
assert(low >= 0 && low <= 0xffffffff); | ||
@@ -197,4 +201,15 @@ assert(high >= 0 && high <= 0xffffffff); | ||
v = value.split(","); | ||
high = parseInt(v[0], 10); | ||
low = parseInt(v[1], 10); | ||
if (v.length === 1) { | ||
// was a single string, good news ! BigInt can be used with nodejs >=12 | ||
let a = BigInt(value); | ||
if (a < BigInt(0)) { | ||
const mask = BigInt("0xFFFFFFFFFFFFFFFF"); | ||
a = (mask + a + BigInt(1)) & mask; | ||
} | ||
high = Number(a >> BigInt(32)); | ||
low = Number(a & BigInt(0xffffffff)); | ||
} else { | ||
high = parseInt(v[0], 10); | ||
low = parseInt(v[1], 10); | ||
} | ||
return constructInt64(high, low); | ||
@@ -205,3 +220,2 @@ } | ||
// our conversion will suffer from some inaccuracy | ||
high = Math.floor(value / 0x100000000); | ||
@@ -208,0 +222,0 @@ low = value - high * 0x100000000; |
Sorry, the diff of this file is not supported yet
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
114557
2184