Skip to content

Commit

Permalink
encoding: rm unused func
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Dec 8, 2024
1 parent 827a692 commit 30a9ae4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion compiler/assemble.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
10 changes: 0 additions & 10 deletions compiler/encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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));
};
2 changes: 1 addition & 1 deletion compiler/wrap.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit 30a9ae4

Please sign in to comment.