From 30a9ae483efc54c8216f53364ac88d55280cee39 Mon Sep 17 00:00:00 2001 From: Oliver Medhurst Date: Sun, 8 Dec 2024 23:34:10 +0000 Subject: [PATCH] encoding: rm unused func --- compiler/assemble.js | 2 +- compiler/encoding.js | 10 ---------- compiler/wrap.js | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/compiler/assemble.js b/compiler/assemble.js index e90bd373..0f4d2c01 100644 --- a/compiler/assemble.js +++ b/compiler/assemble.js @@ -1,5 +1,5 @@ import { Valtype, FuncType, ExportDesc, Section, Magic, Opcodes, PageSize, Reftype } from './wasmSpec.js'; -import { encodeVector, encodeString, encodeLocal, unsignedLEB128, signedLEB128, unsignedLEB128_into, signedLEB128_into, ieee754_binary64, ieee754_binary64_into, unsignedLEB128_length } from './encoding.js'; +import { encodeVector, encodeString, unsignedLEB128, signedLEB128, unsignedLEB128_into, signedLEB128_into, ieee754_binary64, ieee754_binary64_into, unsignedLEB128_length } from './encoding.js'; import { importedFuncs } from './builtins.js'; import { log } from './log.js'; import './prefs.js'; diff --git a/compiler/encoding.js b/compiler/encoding.js index b3449aa1..4dab0622 100644 --- a/compiler/encoding.js +++ b/compiler/encoding.js @@ -10,15 +10,8 @@ export const codifyString = str => { export const encodeString = str => unsignedLEB128(str.length).concat(codifyString(str)); export const encodeVector = data => unsignedLEB128(data.length).concat(data.flat()); -export const encodeLocal = (count, type) => [ - ...unsignedLEB128(count), - type -]; - // todo: this only works with integers within 32 bit range export const signedLEB128 = n => { - if (typeof n === 'bigint') return big_signedLEB128(n); - n |= 0; // just input for small numbers (for perf as common) @@ -45,8 +38,6 @@ export const signedLEB128 = n => { }; export const unsignedLEB128 = n => { - if (typeof n === 'bigint') return big_unsignedLEB128(n); - n |= 0; // just input for small numbers (for perf as common) @@ -217,5 +208,4 @@ export const unsignedLEB128_into = (n, buffer) => { export const ieee754_binary64_into = (value, buffer) => { const data = new Uint8Array(new Float64Array([ value ]).buffer); for (let i = 0; i < 8; i++) buffer.push(data[i]); - // buffer.push(...new Uint8Array(new Float64Array([ value ]).buffer)); }; \ No newline at end of file diff --git a/compiler/wrap.js b/compiler/wrap.js index 5337e57f..fdab8ac3 100644 --- a/compiler/wrap.js +++ b/compiler/wrap.js @@ -1,4 +1,4 @@ -import { encodeVector, encodeLocal } from './encoding.js'; +import { encodeVector } from './encoding.js'; import { importedFuncs } from './builtins.js'; import compile from './index.js'; import disassemble from './ddisassemblee.js';