summaryrefslogtreecommitdiffstats
path: root/node_modules/@webassemblyjs/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@webassemblyjs/ieee754')
-rw-r--r--node_modules/@webassemblyjs/ieee754/LICENSE21
-rw-r--r--node_modules/@webassemblyjs/ieee754/esm/index.js33
-rw-r--r--node_modules/@webassemblyjs/ieee754/lib/index.js52
-rw-r--r--node_modules/@webassemblyjs/ieee754/package.json45
-rw-r--r--node_modules/@webassemblyjs/ieee754/src/index.js47
5 files changed, 198 insertions, 0 deletions
diff --git a/node_modules/@webassemblyjs/ieee754/LICENSE b/node_modules/@webassemblyjs/ieee754/LICENSE
new file mode 100644
index 0000000..87e7e1f
--- /dev/null
+++ b/node_modules/@webassemblyjs/ieee754/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Sven Sauleau <sven@sauleau.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/@webassemblyjs/ieee754/esm/index.js b/node_modules/@webassemblyjs/ieee754/esm/index.js
new file mode 100644
index 0000000..88d9d4c
--- /dev/null
+++ b/node_modules/@webassemblyjs/ieee754/esm/index.js
@@ -0,0 +1,33 @@
+import { write, read } from "@xtuc/ieee754";
+/**
+ * According to https://webassembly.github.io/spec/binary/values.html#binary-float
+ * n = 32/8
+ */
+
+export var NUMBER_OF_BYTE_F32 = 4;
+/**
+ * According to https://webassembly.github.io/spec/binary/values.html#binary-float
+ * n = 64/8
+ */
+
+export var NUMBER_OF_BYTE_F64 = 8;
+export var SINGLE_PRECISION_MANTISSA = 23;
+export var DOUBLE_PRECISION_MANTISSA = 52;
+export function encodeF32(v) {
+ var buffer = [];
+ write(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
+ return buffer;
+}
+export function encodeF64(v) {
+ var buffer = [];
+ write(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
+ return buffer;
+}
+export function decodeF32(bytes) {
+ var buffer = Buffer.from(bytes);
+ return read(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
+}
+export function decodeF64(bytes) {
+ var buffer = Buffer.from(bytes);
+ return read(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
+} \ No newline at end of file
diff --git a/node_modules/@webassemblyjs/ieee754/lib/index.js b/node_modules/@webassemblyjs/ieee754/lib/index.js
new file mode 100644
index 0000000..27b9e22
--- /dev/null
+++ b/node_modules/@webassemblyjs/ieee754/lib/index.js
@@ -0,0 +1,52 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.encodeF32 = encodeF32;
+exports.encodeF64 = encodeF64;
+exports.decodeF32 = decodeF32;
+exports.decodeF64 = decodeF64;
+exports.DOUBLE_PRECISION_MANTISSA = exports.SINGLE_PRECISION_MANTISSA = exports.NUMBER_OF_BYTE_F64 = exports.NUMBER_OF_BYTE_F32 = void 0;
+
+var _ieee = require("@xtuc/ieee754");
+
+/**
+ * According to https://webassembly.github.io/spec/binary/values.html#binary-float
+ * n = 32/8
+ */
+var NUMBER_OF_BYTE_F32 = 4;
+/**
+ * According to https://webassembly.github.io/spec/binary/values.html#binary-float
+ * n = 64/8
+ */
+
+exports.NUMBER_OF_BYTE_F32 = NUMBER_OF_BYTE_F32;
+var NUMBER_OF_BYTE_F64 = 8;
+exports.NUMBER_OF_BYTE_F64 = NUMBER_OF_BYTE_F64;
+var SINGLE_PRECISION_MANTISSA = 23;
+exports.SINGLE_PRECISION_MANTISSA = SINGLE_PRECISION_MANTISSA;
+var DOUBLE_PRECISION_MANTISSA = 52;
+exports.DOUBLE_PRECISION_MANTISSA = DOUBLE_PRECISION_MANTISSA;
+
+function encodeF32(v) {
+ var buffer = [];
+ (0, _ieee.write)(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
+ return buffer;
+}
+
+function encodeF64(v) {
+ var buffer = [];
+ (0, _ieee.write)(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
+ return buffer;
+}
+
+function decodeF32(bytes) {
+ var buffer = Buffer.from(bytes);
+ return (0, _ieee.read)(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
+}
+
+function decodeF64(bytes) {
+ var buffer = Buffer.from(bytes);
+ return (0, _ieee.read)(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
+} \ No newline at end of file
diff --git a/node_modules/@webassemblyjs/ieee754/package.json b/node_modules/@webassemblyjs/ieee754/package.json
new file mode 100644
index 0000000..46f6e06
--- /dev/null
+++ b/node_modules/@webassemblyjs/ieee754/package.json
@@ -0,0 +1,45 @@
+{
+ "_from": "@webassemblyjs/ieee754@1.9.0",
+ "_id": "@webassemblyjs/ieee754@1.9.0",
+ "_inBundle": false,
+ "_integrity": "sha512-dcX8JuYU/gvymzIHc9DgxTzUUTLexWwt8uCTWP3otys596io0L5aW02Gb1RjYpx2+0Jus1h4ZFqjla7umFniTg==",
+ "_location": "/@webassemblyjs/ieee754",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "@webassemblyjs/ieee754@1.9.0",
+ "name": "@webassemblyjs/ieee754",
+ "escapedName": "@webassemblyjs%2fieee754",
+ "scope": "@webassemblyjs",
+ "rawSpec": "1.9.0",
+ "saveSpec": null,
+ "fetchSpec": "1.9.0"
+ },
+ "_requiredBy": [
+ "/@webassemblyjs/wasm-gen",
+ "/@webassemblyjs/wasm-parser"
+ ],
+ "_resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.9.0.tgz",
+ "_shasum": "15c7a0fbaae83fb26143bbacf6d6df1702ad39e4",
+ "_spec": "@webassemblyjs/ieee754@1.9.0",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/@webassemblyjs/wasm-gen",
+ "bundleDependencies": false,
+ "dependencies": {
+ "@xtuc/ieee754": "^1.2.0"
+ },
+ "deprecated": false,
+ "description": "IEEE754 decoder and encoder",
+ "gitHead": "0440b420888c1f7701eb9762ec657775506b87d8",
+ "license": "MIT",
+ "main": "lib/index.js",
+ "module": "esm/index.js",
+ "name": "@webassemblyjs/ieee754",
+ "publishConfig": {
+ "access": "public"
+ },
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "version": "1.9.0"
+}
diff --git a/node_modules/@webassemblyjs/ieee754/src/index.js b/node_modules/@webassemblyjs/ieee754/src/index.js
new file mode 100644
index 0000000..c8540a5
--- /dev/null
+++ b/node_modules/@webassemblyjs/ieee754/src/index.js
@@ -0,0 +1,47 @@
+// @flow
+
+import { write, read } from "@xtuc/ieee754";
+
+/**
+ * According to https://webassembly.github.io/spec/binary/values.html#binary-float
+ * n = 32/8
+ */
+export const NUMBER_OF_BYTE_F32 = 4;
+
+/**
+ * According to https://webassembly.github.io/spec/binary/values.html#binary-float
+ * n = 64/8
+ */
+export const NUMBER_OF_BYTE_F64 = 8;
+
+export const SINGLE_PRECISION_MANTISSA = 23;
+
+export const DOUBLE_PRECISION_MANTISSA = 52;
+
+export function encodeF32(v: number): Array<number> {
+ const buffer = [];
+
+ write(buffer, v, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
+
+ return buffer;
+}
+
+export function encodeF64(v: number): Array<number> {
+ const buffer = [];
+
+ write(buffer, v, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
+
+ return buffer;
+}
+
+export function decodeF32(bytes: Array<Byte>): number {
+ const buffer = Buffer.from(bytes);
+
+ return read(buffer, 0, true, SINGLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F32);
+}
+
+export function decodeF64(bytes: Array<Byte>): number {
+ const buffer = Buffer.from(bytes);
+
+ return read(buffer, 0, true, DOUBLE_PRECISION_MANTISSA, NUMBER_OF_BYTE_F64);
+}