rabin-wasm
Advanced tools
Comparing version 0.0.8 to 0.1.0
@@ -8,5 +8,4 @@ const fs = require('fs'); | ||
const { instantiateBuffer } = require("assemblyscript/lib/loader"); | ||
const imports = {}; | ||
const compiled = instantiateBuffer(fs.readFileSync(__dirname + "/../dist/rabin.wasm"), imports); | ||
const { instantiateSync } = require("@assemblyscript/loader"); | ||
const compiled = instantiateSync(fs.readFileSync(__dirname + "/../dist/rabin.wasm"), {}); | ||
@@ -23,3 +22,3 @@ module.exports = RabinStream | ||
var max = +opts.max || 32 * 1024 | ||
this.rabin = new Rabin(avgBits, min, max, 64, compiled) | ||
this.rabin = new Rabin(compiled, avgBits, min, max) | ||
this.nextCb = null | ||
@@ -68,6 +67,6 @@ this.buffers = new BufferList() | ||
var sizes = this.rabin.fingerprint(Buffer.concat(this.pending)) | ||
this.pending = [] | ||
debug('chunks', sizes) | ||
debug('chunks', sizes.buffer.byteLength) | ||
@@ -91,2 +90,2 @@ for (var i = 0; i < sizes.length; i++) { | ||
this.emit('close') | ||
} | ||
} |
const { instantiateStreaming } = require("assemblyscript/lib/loader"); | ||
const { instantiateStreaming } = require("@assemblyscript/loader"); | ||
@@ -8,4 +8,4 @@ loadWebAssembly.supported = typeof WebAssembly !== 'undefined' | ||
if (!loadWebAssembly.supported) return null | ||
var wasm = new Uint8Array([0,97,115,109,1,0,0,0,1,90,16,96,0,0,96,2,127,127,1,127,96,4,127,127,127,127,0,96,1,127,1,127,96,3,127,127,127,0,96,1,126,1,127,96,2,126,126,1,126,96,5,127,127,127,127,127,1,127,96,3,127,127,126,0,96,2,127,127,1,126,96,3,127,127,127,1,127,96,1,127,0,96,2,127,127,0,96,1,127,1,126,96,2,127,126,0,96,0,1,127,2,13,1,3,101,110,118,5,97,98,111,114,116,0,2,3,57,56,3,3,12,3,3,15,5,6,1,8,4,1,9,11,7,4,10,10,11,0,0,0,3,12,3,12,3,12,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,4,4,1,112,0,1,5,3,1,0,1,6,26,5,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,7,253,6,44,6,109,101,109,111,114,121,2,0,5,116,97,98,108,101,1,0,6,100,101,103,114,101,101,0,7,3,109,111,100,0,8,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,23,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,24,21,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,25,21,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,26,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,27,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,28,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,29,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,30,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,31,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,32,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,33,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,34,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,35,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,36,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,37,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,38,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,39,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,40,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,41,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,42,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,43,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,44,27,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,95,100,101,103,114,101,101,0,45,27,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,95,100,101,103,114,101,101,0,46,26,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,95,115,104,105,102,116,0,47,26,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,95,115,104,105,102,116,0,48,22,82,97,98,105,110,35,103,101,116,58,97,118,101,114,97,103,101,95,98,105,116,115,0,49,22,82,97,98,105,110,35,115,101,116,58,97,118,101,114,97,103,101,95,98,105,116,115,0,50,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,51,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,52,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,53,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,54,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,55,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,56,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,15,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,16,14,109,101,109,111,114,121,46,99,111,109,112,97,114,101,0,18,15,109,101,109,111,114,121,46,97,108,108,111,99,97,116,101,0,4,11,109,101,109,111,114,121,46,102,114,101,101,0,19,12,109,101,109,111,114,121,46,114,101,115,101,116,0,20,8,1,21,9,7,1,0,65,0,11,1,22,10,188,30,56,104,1,3,127,32,0,65,128,128,128,128,4,75,4,64,0,11,35,1,34,1,32,0,65,1,32,0,65,1,75,27,106,65,7,106,65,120,113,34,0,63,0,34,2,65,16,116,75,4,64,32,2,32,0,32,1,107,65,255,255,3,106,65,128,128,124,113,65,16,118,34,3,32,2,32,3,74,27,64,0,65,0,72,4,64,32,3,64,0,65,0,72,4,64,0,11,11,11,32,0,36,1,32,1,11,51,1,1,127,32,0,65,248,255,255,255,3,75,4,64,65,0,65,200,0,65,26,65,2,16,0,0,11,65,1,65,32,32,0,65,7,106,103,107,116,16,1,34,1,32,0,54,2,0,32,1,11,145,3,1,1,127,32,1,69,4,64,15,11,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,4,64,15,11,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,4,64,15,11,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,4,64,15,11,65,0,32,0,107,65,3,113,34,2,32,0,106,34,0,65,0,54,2,0,32,1,32,2,107,65,124,113,34,1,32,0,106,65,4,107,65,0,54,2,0,32,1,65,8,77,4,64,15,11,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,4,64,15,11,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,65,4,113,65,24,106,34,2,32,0,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,6,0,32,0,16,1,11,76,1,1,127,65,128,16,16,2,34,1,65,8,106,65,128,16,16,3,32,0,69,4,64,65,12,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,32,1,54,2,0,32,0,65,0,54,2,4,32,0,65,128,16,54,2,8,32,0,11,8,0,65,12,16,1,16,5,11,70,2,1,127,1,126,66,128,128,128,128,128,128,128,128,128,127,33,2,3,64,2,64,32,1,65,192,0,78,13,0,32,0,32,2,131,66,0,86,4,64,65,63,32,1,107,15,5,32,2,66,1,136,33,2,32,1,65,1,106,33,1,12,2,11,0,11,11,65,127,11,175,2,2,1,127,2,126,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,0,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,32,1,33,4,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,3,32,4,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,78,4,64,32,1,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,0,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,1,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,107,172,134,32,0,133,33,0,12,1,11,11,32,0,11,96,1,1,127,32,1,65,248,255,255,255,3,75,4,64,65,0,65,8,65,23,65,34,16,0,0,11,32,1,16,2,34,2,65,8,106,32,1,16,3,32,0,69,4,64,65,12,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,32,2,54,2,0,32,0,65,0,54,2,4,32,0,32,1,54,2,8,32,0,11,49,0,32,1,32,0,40,2,8,65,3,118,79,4,64,65,0,65,8,65,50,65,63,16,0,0,11,32,0,40,2,4,32,0,40,2,0,32,1,65,3,116,106,106,32,2,55,3,8,11,43,0,32,1,32,0,40,2,8,79,4,64,65,0,65,8,65,50,65,63,16,0,0,11,32,0,40,2,4,32,1,32,0,40,2,0,106,106,32,2,58,0,8,11,41,0,32,1,32,0,40,2,8,79,4,64,65,0,65,8,65,39,65,63,16,0,0,11,32,0,40,2,4,32,1,32,0,40,2,0,106,106,45,0,8,11,47,0,32,1,32,0,40,2,8,65,3,118,79,4,64,65,0,65,8,65,39,65,63,16,0,0,11,32,0,40,2,4,32,0,40,2,0,32,1,65,3,116,106,106,41,3,8,11,166,10,2,3,127,5,126,35,2,69,4,64,3,64,32,2,65,128,2,72,4,64,32,2,65,255,1,113,173,33,4,32,0,41,3,72,33,6,3,64,2,127,32,4,33,5,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,172,134,32,5,133,33,4,12,1,11,11,65,0,33,1,3,64,32,1,32,0,40,2,4,65,1,107,72,4,64,32,5,66,8,134,33,4,32,0,41,3,72,33,6,3,64,2,127,32,4,33,5,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,107,172,134,32,5,133,33,4,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,35,4,32,2,32,5,16,10,32,2,65,1,106,33,2,12,1,11,11,2,127,32,0,41,3,72,33,4,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,4,32,5,131,66,0,86,13,2,26,32,5,66,1,136,33,5,32,2,65,1,106,33,2,12,1,11,11,65,127,11,172,33,8,65,0,33,2,3,64,32,2,65,128,2,72,4,64,35,3,33,3,32,2,172,32,8,134,33,5,32,0,41,3,72,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,172,134,32,5,133,33,5,12,1,11,11,32,3,32,2,32,2,172,32,8,134,32,5,132,16,10,32,2,65,1,106,33,2,12,1,11,11,65,1,36,2,11,32,0,66,0,55,3,24,32,0,66,0,55,3,32,65,0,33,2,3,64,32,2,32,0,40,2,4,72,4,64,32,0,40,2,0,32,2,65,0,16,11,32,2,65,1,106,33,2,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,12,33,1,32,0,40,2,0,32,0,40,2,8,65,1,16,11,32,0,32,0,41,3,40,35,4,32,1,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,1,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,66,1,132,55,3,40,32,0,32,0,41,3,40,35,3,32,1,65,255,1,113,16,13,133,55,3,40,11,234,1,0,32,0,69,4,64,65,128,1,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,66,0,55,3,96,32,0,66,0,55,3,104,32,0,66,0,55,3,112,32,0,66,0,55,3,120,32,0,32,1,173,55,3,96,32,0,32,2,173,55,3,104,32,0,32,3,173,55,3,112,32,0,65,12,16,1,32,4,16,9,54,2,0,32,0,32,4,54,2,4,32,0,66,1,32,0,41,3,96,134,66,1,125,55,3,120,32,0,66,243,130,183,218,216,230,232,30,55,3,72,32,0,66,53,55,3,80,32,0,32,0,41,3,80,66,8,125,55,3,88,32,0,16,14,32,0,11,206,4,1,5,127,32,1,40,2,8,33,4,32,1,40,2,0,65,8,106,33,5,3,64,2,127,65,0,33,3,3,64,32,3,32,4,72,4,64,32,3,32,5,106,45,0,0,33,1,32,0,40,2,0,32,0,40,2,8,16,12,33,6,32,0,40,2,0,32,0,40,2,8,32,1,16,11,32,0,32,0,41,3,40,35,4,32,6,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,6,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,32,1,173,132,55,3,40,32,0,32,0,41,3,40,35,3,32,6,65,255,1,113,16,13,133,55,3,40,32,0,32,0,41,3,16,66,1,124,55,3,16,32,0,32,0,41,3,24,66,1,124,55,3,24,2,127,32,0,41,3,16,32,0,41,3,104,90,34,1,4,64,32,0,41,3,40,32,0,41,3,120,131,66,0,81,33,1,11,32,1,69,11,4,127,32,0,41,3,16,32,0,41,3,112,90,5,32,1,11,4,64,32,0,32,0,41,3,32,55,3,48,32,0,32,0,41,3,16,55,3,56,32,0,32,0,41,3,40,55,3,64,65,0,33,1,3,64,32,1,32,0,40,2,4,72,4,64,32,0,40,2,0,32,1,65,0,16,11,32,1,65,1,106,33,1,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,12,33,1,32,0,40,2,0,32,0,40,2,8,65,1,16,11,32,0,32,0,41,3,40,35,4,32,1,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,1,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,66,1,132,55,3,40,32,0,32,0,41,3,40,35,3,32,1,65,255,1,113,16,13,133,55,3,40,32,3,65,1,106,12,3,5,32,3,65,1,106,33,3,12,2,11,0,11,11,65,127,11,34,1,65,0,78,4,64,32,4,32,1,107,33,4,32,1,32,5,106,33,5,32,7,34,1,65,1,106,33,7,32,2,40,2,4,32,2,40,2,0,32,1,65,2,116,106,106,32,0,41,3,56,62,2,8,32,2,40,2,4,32,2,40,2,0,32,1,65,2,116,106,106,40,2,8,26,12,1,11,11,11,88,1,1,127,32,0,32,1,70,4,64,65,0,15,11,3,64,32,2,65,0,71,34,3,4,64,32,0,45,0,0,32,1,45,0,0,70,33,3,11,32,3,4,64,32,2,65,1,107,33,2,32,0,65,1,106,33,0,32,1,65,1,106,33,1,12,1,11,11,32,2,4,127,32,0,45,0,0,32,1,45,0,0,107,5,65,0,11,11,10,0,32,0,32,1,32,2,16,17,11,3,0,1,11,6,0,35,0,36,1,11,19,0,65,136,1,36,0,35,0,36,1,16,6,36,3,16,6,36,4,11,3,0,1,11,7,0,32,0,40,2,0,11,9,0,32,0,32,1,54,2,0,11,7,0,32,0,40,2,4,11,9,0,32,0,32,1,54,2,4,11,7,0,32,0,40,2,8,11,9,0,32,0,32,1,54,2,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,41,3,96,11,9,0,32,0,32,1,55,3,96,11,7,0,32,0,41,3,104,11,9,0,32,0,32,1,55,3,104,11,7,0,32,0,41,3,112,11,9,0,32,0,32,1,55,3,112,11,7,0,32,0,41,3,120,11,9,0,32,0,32,1,55,3,120,11,11,128,1,2,0,65,8,11,57,27,0,0,0,126,0,108,0,105,0,98,0,47,0,105,0,110,0,116,0,101,0,114,0,110,0,97,0,108,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,200,0,11,59,28,0,0,0,126,0,108,0,105,0,98,0,47,0,105,0,110,0,116,0,101,0,114,0,110,0,97,0,108,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,32,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,14,114,97,98,105,110,46,119,97,115,109,46,109,97,112]) | ||
var wasm = new Uint8Array([0,97,115,109,1,0,0,0,1,77,14,96,2,127,127,1,127,96,1,127,0,96,1,127,1,127,96,0,0,96,3,127,127,127,1,127,96,4,127,127,127,127,0,96,3,127,127,127,0,96,1,126,1,127,96,2,126,126,1,126,96,4,127,127,127,127,1,127,96,2,127,127,0,96,1,127,1,126,96,2,127,126,0,96,0,1,127,2,13,1,3,101,110,118,5,97,98,111,114,116,0,5,3,43,42,1,0,2,1,3,10,4,13,7,8,0,6,2,9,4,3,2,10,11,12,11,12,11,12,11,12,11,12,11,12,11,12,11,12,11,12,11,12,11,12,2,10,5,3,1,0,1,6,47,9,127,1,65,0,11,127,1,65,0,11,127,0,65,3,11,127,0,65,4,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,0,65,224,1,11,127,0,65,6,11,7,192,5,39,6,109,101,109,111,114,121,2,0,7,95,95,97,108,108,111,99,0,2,8,95,95,114,101,116,97,105,110,0,3,9,95,95,114,101,108,101,97,115,101,0,4,9,95,95,99,111,108,108,101,99,116,0,5,11,95,95,114,116,116,105,95,98,97,115,101,3,7,13,73,110,116,51,50,65,114,114,97,121,95,73,68,3,2,13,85,105,110,116,56,65,114,114,97,121,95,73,68,3,3,6,100,101,103,114,101,101,0,9,3,109,111,100,0,10,5,82,97,98,105,110,3,8,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,17,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,18,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,19,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,20,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,21,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,22,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,23,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,24,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,25,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,26,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,27,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,28,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,29,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,30,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,31,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,32,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,33,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,34,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,35,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,36,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,37,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,38,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,39,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,40,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,41,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,42,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,14,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,15,8,1,16,10,241,21,42,70,1,2,127,32,0,63,0,34,2,65,16,116,34,1,75,4,64,32,2,32,0,32,1,107,65,255,255,3,106,65,128,128,124,113,65,16,118,34,1,32,2,32,1,74,27,64,0,65,0,72,4,64,32,1,64,0,65,0,72,4,64,0,11,11,11,32,0,36,1,11,82,1,3,127,32,0,65,240,255,255,255,3,75,4,64,0,11,35,1,65,16,106,34,3,32,0,65,15,106,65,112,113,34,2,65,16,32,2,65,16,75,27,34,4,106,16,1,32,3,65,16,107,34,2,32,4,54,2,0,32,2,65,127,54,2,4,32,2,32,1,54,2,8,32,2,32,0,54,2,12,32,3,11,4,0,32,0,11,3,0,1,11,3,0,1,11,140,3,1,1,127,2,64,32,1,69,13,0,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,13,0,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,13,0,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,13,0,32,1,65,0,32,0,107,65,3,113,34,1,107,33,2,32,0,32,1,106,34,0,65,0,54,2,0,32,2,65,124,113,34,1,32,0,106,65,4,107,65,0,54,2,0,32,1,65,8,77,13,0,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,13,0,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,65,4,113,65,24,106,34,2,32,0,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,11,110,0,32,1,65,240,255,255,255,3,32,2,118,75,4,64,65,24,65,200,0,65,23,65,56,16,0,0,11,32,1,32,2,116,34,2,65,0,16,2,34,1,32,2,16,6,32,0,69,4,64,65,12,65,2,16,2,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,40,2,0,26,32,0,32,1,54,2,0,32,0,32,1,54,2,4,32,0,32,2,54,2,8,32,0,11,15,0,65,12,65,5,16,2,65,128,2,65,3,16,7,11,70,2,1,127,1,126,66,128,128,128,128,128,128,128,128,128,127,33,2,3,64,2,64,32,1,65,192,0,78,13,0,32,0,32,2,131,66,0,82,4,64,65,63,32,1,107,15,5,32,2,66,1,136,33,2,32,1,65,1,106,33,1,12,2,11,0,11,11,65,127,11,170,1,2,1,127,1,126,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,0,32,3,131,66,0,82,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,1,32,3,131,66,0,82,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,107,34,2,65,0,72,69,4,64,32,1,32,2,172,134,32,0,133,33,0,12,1,11,11,32,0,11,38,0,32,1,32,0,40,2,8,79,4,64,65,128,1,65,184,1,65,148,1,65,44,16,0,0,11,32,0,40,2,4,32,1,106,45,0,0,11,40,0,32,1,32,0,40,2,8,79,4,64,65,128,1,65,184,1,65,159,1,65,44,16,0,0,11,32,0,40,2,4,32,1,106,32,2,58,0,0,11,195,6,2,4,127,5,126,35,4,69,4,64,32,0,41,3,64,33,7,3,64,32,3,65,128,2,72,4,64,32,3,65,255,1,113,173,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,5,32,6,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,5,32,7,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,34,2,65,0,78,4,64,32,7,32,2,172,134,32,6,133,33,6,12,1,11,11,65,0,33,1,3,64,32,1,65,63,72,4,64,32,6,66,8,134,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,5,32,6,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,5,32,7,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,2,65,1,106,33,2,12,1,11,11,65,127,11,107,34,2,65,0,78,4,64,32,7,32,2,172,134,32,6,133,33,6,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,35,6,40,2,4,32,3,65,3,116,106,32,6,55,3,0,32,3,65,1,106,33,3,12,1,11,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,6,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,6,32,7,131,66,0,82,13,2,26,32,6,66,1,136,33,6,32,3,65,1,106,33,3,12,1,11,11,65,127,11,172,33,8,65,0,33,3,3,64,32,3,65,128,2,72,4,64,35,5,33,4,32,3,172,32,8,134,34,9,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,5,32,6,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,5,32,7,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,34,2,65,0,78,4,64,32,7,32,2,172,134,32,6,133,33,6,12,1,11,11,32,4,40,2,4,32,3,65,3,116,106,32,6,32,9,132,55,3,0,32,3,65,1,106,33,3,12,1,11,11,65,1,36,4,11,32,0,66,0,55,3,32,32,0,65,0,54,2,0,32,0,66,0,55,3,8,32,0,66,0,55,3,32,32,0,40,2,96,32,0,40,2,0,34,2,16,11,33,1,32,0,40,2,96,32,2,65,1,16,12,32,0,32,0,41,3,32,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,32,32,0,32,2,65,1,106,65,192,0,111,54,2,0,32,0,35,5,40,2,4,32,0,41,3,32,34,7,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,7,66,8,134,66,1,132,133,55,3,32,32,0,11,170,1,0,32,0,69,4,64,65,228,0,65,6,16,2,33,0,11,32,0,65,0,54,2,0,32,0,66,0,55,3,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,65,12,65,4,16,2,65,192,0,65,0,16,7,54,2,96,32,0,32,2,173,55,3,72,32,0,32,3,173,55,3,80,32,0,66,1,32,1,173,134,66,1,125,55,3,88,32,0,66,243,130,183,218,216,230,232,30,55,3,64,32,0,16,13,26,32,0,11,129,4,2,6,127,6,126,32,1,40,2,8,33,5,32,1,40,2,4,33,6,3,64,2,127,32,0,41,3,16,33,10,32,0,41,3,8,33,9,32,0,41,3,88,33,11,32,0,41,3,72,33,12,32,0,41,3,80,33,13,65,0,33,1,3,64,32,1,32,5,72,4,64,32,1,32,6,106,45,0,0,33,3,32,0,40,2,96,32,0,40,2,0,34,4,16,11,33,7,32,0,40,2,96,32,4,32,3,16,12,32,0,32,0,41,3,32,35,6,40,2,4,32,7,65,3,116,106,41,3,0,133,55,3,32,32,0,32,4,65,1,106,65,192,0,111,54,2,0,32,0,35,5,40,2,4,32,0,41,3,32,34,14,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,3,173,32,14,66,8,134,132,133,55,3,32,32,10,66,1,124,33,10,32,9,66,1,124,34,9,32,12,90,4,127,32,0,41,3,32,32,11,131,80,5,65,0,11,4,127,65,1,5,32,9,32,13,90,11,4,64,32,0,32,0,41,3,24,55,3,40,32,0,32,9,55,3,48,32,0,32,0,41,3,32,55,3,56,32,0,32,10,55,3,16,32,0,32,9,55,3,8,32,0,66,0,55,3,32,32,0,65,0,54,2,0,32,0,66,0,55,3,8,32,0,66,0,55,3,32,32,0,40,2,96,32,0,40,2,0,34,3,16,11,33,4,32,0,40,2,96,32,3,65,1,16,12,32,0,32,0,41,3,32,35,6,40,2,4,32,4,65,3,116,106,41,3,0,133,55,3,32,32,0,32,3,65,1,106,65,192,0,111,54,2,0,32,0,35,5,40,2,4,32,0,41,3,32,34,9,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,9,66,8,134,66,1,132,133,55,3,32,32,0,40,2,96,40,2,4,65,192,0,16,6,32,1,65,1,106,12,3,5,32,1,65,1,106,33,1,12,2,11,0,11,11,32,0,32,10,55,3,16,32,0,32,9,55,3,8,65,127,11,34,1,65,0,78,4,64,32,5,32,1,107,33,5,32,1,32,6,106,33,6,32,2,40,2,4,32,8,65,1,106,34,8,65,2,116,106,32,0,41,3,48,62,2,0,12,1,11,11,32,2,11,20,0,65,160,2,36,0,65,160,2,36,1,16,8,36,5,16,8,36,6,11,7,0,32,0,40,2,0,11,9,0,32,0,32,1,54,2,0,11,7,0,32,0,41,3,8,11,9,0,32,0,32,1,55,3,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,40,2,96,11,15,0,32,1,40,2,96,26,32,0,32,1,54,2,96,11,11,152,2,5,0,65,8,11,43,28,0,0,0,1,0,0,0,1,0,0,0,28,0,0,0,73,0,110,0,118,0,97,0,108,0,105,0,100,0,32,0,108,0,101,0,110,0,103,0,116,0,104,0,65,56,11,53,38,0,0,0,1,0,0,0,1,0,0,0,38,0,0,0,126,0,108,0,105,0,98,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,65,240,0,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,73,0,110,0,100,0,101,0,120,0,32,0,111,0,117,0,116,0,32,0,111,0,102,0,32,0,114,0,97,0,110,0,103,0,101,0,65,168,1,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,126,0,108,0,105,0,98,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,224,1,11,53,7,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,145,4,0,0,2,0,0,0,49,0,0,0,2,0,0,0,17,1,0,0,2,0,0,0,16,0,32,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,14,114,97,98,105,110,46,119,97,115,109,46,109,97,112]) | ||
// make it work async because browsers throw when a wasm module is bigger than 4kb and load sync | ||
@@ -12,0 +12,0 @@ return instantiateStreaming(new Response(new Blob([wasm], {type: 'application/wasm'})), imp) |
const { instantiateBuffer } = require("assemblyscript/lib/loader"); | ||
const { instantiateSync } = require("@assemblyscript/loader"); | ||
const fs = require('fs') | ||
@@ -9,5 +9,5 @@ | ||
if (!loadWebAssembly.supported) return null | ||
return instantiateBuffer(fs.readFileSync(__dirname + "/../dist/rabin.wasm"), imp); | ||
return instantiateSync(fs.readFileSync(__dirname + "/../dist/rabin.wasm"), imp); | ||
} | ||
module.exports = loadWebAssembly |
@@ -11,68 +11,16 @@ declare module ASModule { | ||
type bool = any; | ||
const MAX_BLENGTH: i32; | ||
const HEADER_SIZE: u32; | ||
function allocateUnsafe(byteLength: i32): u32; | ||
function abort(message: u32, fileName: u32, lineNumber: u32, columnNumber: u32): void; | ||
var HEAP_BASE: u32; | ||
namespace memory { | ||
function compare(vl: u32, vr: u32, n: u32): i32; | ||
function allocate(size: u32): u32; | ||
function free(ptr: u32): void; | ||
function reset(): void; | ||
export function __alloc(size: u32, id: u32): u32; | ||
export function __retain(ref: u32): u32; | ||
export function __release(ref: u32): void; | ||
export function __collect(): void; | ||
export var __rtti_base: u32; | ||
export var Int32Array_ID: u32; | ||
export var Uint8Array_ID: u32; | ||
export function degree(polynom: U64): i32; | ||
export function mod(x: U64, p: U64): U64; | ||
export class Rabin { | ||
constructor(average_bits: u32, minsize: u32, maxsize: u32); | ||
fingerprint(buf: u32, lengths: u32): u32; | ||
} | ||
function memcmp(vl: u32, vr: u32, n: u32): i32; | ||
function memset(dest: u32, c: u8, n: u32): void; | ||
const HEADER_SIZE: u32; | ||
const MAX_LENGTH: i32; | ||
enum CharCode { | ||
PLUS = 43, | ||
MINUS = 45, | ||
DOT = 46, | ||
_0 = 48, | ||
_1 = 49, | ||
_2 = 50, | ||
_3 = 51, | ||
_4 = 52, | ||
_5 = 53, | ||
_6 = 54, | ||
_7 = 55, | ||
_8 = 56, | ||
_9 = 57, | ||
A = 65, | ||
B = 66, | ||
E = 69, | ||
N = 78, | ||
O = 79, | ||
X = 88, | ||
Z = 90, | ||
a = 97, | ||
b = 98, | ||
e = 101, | ||
n = 110, | ||
o = 111, | ||
x = 120, | ||
z = 122, | ||
} | ||
var tables_initialized: bool; | ||
var modTable: u32; | ||
var outTable: u32; | ||
function degree(polynom: U64): i32; | ||
function mod(x: U64, p: U64): U64; | ||
function rabin_init(h: u32): u32; | ||
class Rabin { | ||
constructor(average_bits: u32, minsize: u32, maxsize: u32, window_size: i32); | ||
constructor(average_bits: u32, minsize: u32, maxsize: u32, window_size: i32); | ||
fingerprint(buf: u32, lengths: u32): void; | ||
} | ||
function computeSize(byteLength: i32): u32; | ||
const AL_MASK: u32; | ||
const MAX_SIZE_32: u32; | ||
var startOffset: u32; | ||
var offset: u32; | ||
function __memory_allocate(size: u32): u32; | ||
function __memory_free(ptr: u32): void; | ||
function __memory_reset(): void; | ||
const AL_BITS: u32; | ||
const AL_SIZE: u32; | ||
} | ||
export default ASModule; |
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Rabin = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
const { instantiateStreaming } = require("assemblyscript/lib/loader"); | ||
const { instantiateStreaming } = require("@assemblyscript/loader"); | ||
@@ -9,4 +9,4 @@ loadWebAssembly.supported = typeof WebAssembly !== 'undefined' | ||
if (!loadWebAssembly.supported) return null | ||
var wasm = new Uint8Array([0,97,115,109,1,0,0,0,1,90,16,96,0,0,96,2,127,127,1,127,96,4,127,127,127,127,0,96,1,127,1,127,96,3,127,127,127,0,96,1,126,1,127,96,2,126,126,1,126,96,5,127,127,127,127,127,1,127,96,3,127,127,126,0,96,2,127,127,1,126,96,3,127,127,127,1,127,96,1,127,0,96,2,127,127,0,96,1,127,1,126,96,2,127,126,0,96,0,1,127,2,13,1,3,101,110,118,5,97,98,111,114,116,0,2,3,57,56,3,3,12,3,3,15,5,6,1,8,4,1,9,11,7,4,10,10,11,0,0,0,3,12,3,12,3,12,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,13,14,4,4,1,112,0,1,5,3,1,0,1,6,26,5,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,7,253,6,44,6,109,101,109,111,114,121,2,0,5,116,97,98,108,101,1,0,6,100,101,103,114,101,101,0,7,3,109,111,100,0,8,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,23,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,24,21,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,25,21,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,26,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,27,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,28,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,29,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,30,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,31,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,32,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,33,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,34,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,35,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,36,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,37,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,38,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,39,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,40,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,41,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,42,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,43,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,44,27,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,95,100,101,103,114,101,101,0,45,27,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,95,100,101,103,114,101,101,0,46,26,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,95,115,104,105,102,116,0,47,26,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,95,115,104,105,102,116,0,48,22,82,97,98,105,110,35,103,101,116,58,97,118,101,114,97,103,101,95,98,105,116,115,0,49,22,82,97,98,105,110,35,115,101,116,58,97,118,101,114,97,103,101,95,98,105,116,115,0,50,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,51,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,52,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,53,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,54,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,55,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,56,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,15,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,16,14,109,101,109,111,114,121,46,99,111,109,112,97,114,101,0,18,15,109,101,109,111,114,121,46,97,108,108,111,99,97,116,101,0,4,11,109,101,109,111,114,121,46,102,114,101,101,0,19,12,109,101,109,111,114,121,46,114,101,115,101,116,0,20,8,1,21,9,7,1,0,65,0,11,1,22,10,188,30,56,104,1,3,127,32,0,65,128,128,128,128,4,75,4,64,0,11,35,1,34,1,32,0,65,1,32,0,65,1,75,27,106,65,7,106,65,120,113,34,0,63,0,34,2,65,16,116,75,4,64,32,2,32,0,32,1,107,65,255,255,3,106,65,128,128,124,113,65,16,118,34,3,32,2,32,3,74,27,64,0,65,0,72,4,64,32,3,64,0,65,0,72,4,64,0,11,11,11,32,0,36,1,32,1,11,51,1,1,127,32,0,65,248,255,255,255,3,75,4,64,65,0,65,200,0,65,26,65,2,16,0,0,11,65,1,65,32,32,0,65,7,106,103,107,116,16,1,34,1,32,0,54,2,0,32,1,11,145,3,1,1,127,32,1,69,4,64,15,11,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,4,64,15,11,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,4,64,15,11,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,4,64,15,11,65,0,32,0,107,65,3,113,34,2,32,0,106,34,0,65,0,54,2,0,32,1,32,2,107,65,124,113,34,1,32,0,106,65,4,107,65,0,54,2,0,32,1,65,8,77,4,64,15,11,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,4,64,15,11,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,65,4,113,65,24,106,34,2,32,0,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,6,0,32,0,16,1,11,76,1,1,127,65,128,16,16,2,34,1,65,8,106,65,128,16,16,3,32,0,69,4,64,65,12,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,32,1,54,2,0,32,0,65,0,54,2,4,32,0,65,128,16,54,2,8,32,0,11,8,0,65,12,16,1,16,5,11,70,2,1,127,1,126,66,128,128,128,128,128,128,128,128,128,127,33,2,3,64,2,64,32,1,65,192,0,78,13,0,32,0,32,2,131,66,0,86,4,64,65,63,32,1,107,15,5,32,2,66,1,136,33,2,32,1,65,1,106,33,1,12,2,11,0,11,11,65,127,11,175,2,2,1,127,2,126,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,0,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,32,1,33,4,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,3,32,4,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,78,4,64,32,1,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,0,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,1,32,3,131,66,0,86,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,107,172,134,32,0,133,33,0,12,1,11,11,32,0,11,96,1,1,127,32,1,65,248,255,255,255,3,75,4,64,65,0,65,8,65,23,65,34,16,0,0,11,32,1,16,2,34,2,65,8,106,32,1,16,3,32,0,69,4,64,65,12,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,32,2,54,2,0,32,0,65,0,54,2,4,32,0,32,1,54,2,8,32,0,11,49,0,32,1,32,0,40,2,8,65,3,118,79,4,64,65,0,65,8,65,50,65,63,16,0,0,11,32,0,40,2,4,32,0,40,2,0,32,1,65,3,116,106,106,32,2,55,3,8,11,43,0,32,1,32,0,40,2,8,79,4,64,65,0,65,8,65,50,65,63,16,0,0,11,32,0,40,2,4,32,1,32,0,40,2,0,106,106,32,2,58,0,8,11,41,0,32,1,32,0,40,2,8,79,4,64,65,0,65,8,65,39,65,63,16,0,0,11,32,0,40,2,4,32,1,32,0,40,2,0,106,106,45,0,8,11,47,0,32,1,32,0,40,2,8,65,3,118,79,4,64,65,0,65,8,65,39,65,63,16,0,0,11,32,0,40,2,4,32,0,40,2,0,32,1,65,3,116,106,106,41,3,8,11,166,10,2,3,127,5,126,35,2,69,4,64,3,64,32,2,65,128,2,72,4,64,32,2,65,255,1,113,173,33,4,32,0,41,3,72,33,6,3,64,2,127,32,4,33,5,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,172,134,32,5,133,33,4,12,1,11,11,65,0,33,1,3,64,32,1,32,0,40,2,4,65,1,107,72,4,64,32,5,66,8,134,33,4,32,0,41,3,72,33,6,3,64,2,127,32,4,33,5,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,3,65,1,106,33,3,12,1,11,11,65,127,11,107,172,134,32,5,133,33,4,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,35,4,32,2,32,5,16,10,32,2,65,1,106,33,2,12,1,11,11,2,127,32,0,41,3,72,33,4,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,4,32,5,131,66,0,86,13,2,26,32,5,66,1,136,33,5,32,2,65,1,106,33,2,12,1,11,11,65,127,11,172,33,8,65,0,33,2,3,64,32,2,65,128,2,72,4,64,35,3,33,3,32,2,172,32,8,134,33,5,32,0,41,3,72,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,32,6,33,7,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,7,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,78,4,64,32,6,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,5,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,4,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,4,32,6,131,66,0,86,13,2,26,32,4,66,1,136,33,4,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,172,134,32,5,133,33,5,12,1,11,11,32,3,32,2,32,2,172,32,8,134,32,5,132,16,10,32,2,65,1,106,33,2,12,1,11,11,65,1,36,2,11,32,0,66,0,55,3,24,32,0,66,0,55,3,32,65,0,33,2,3,64,32,2,32,0,40,2,4,72,4,64,32,0,40,2,0,32,2,65,0,16,11,32,2,65,1,106,33,2,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,12,33,1,32,0,40,2,0,32,0,40,2,8,65,1,16,11,32,0,32,0,41,3,40,35,4,32,1,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,1,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,66,1,132,55,3,40,32,0,32,0,41,3,40,35,3,32,1,65,255,1,113,16,13,133,55,3,40,11,234,1,0,32,0,69,4,64,65,128,1,16,1,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,66,0,55,3,96,32,0,66,0,55,3,104,32,0,66,0,55,3,112,32,0,66,0,55,3,120,32,0,32,1,173,55,3,96,32,0,32,2,173,55,3,104,32,0,32,3,173,55,3,112,32,0,65,12,16,1,32,4,16,9,54,2,0,32,0,32,4,54,2,4,32,0,66,1,32,0,41,3,96,134,66,1,125,55,3,120,32,0,66,243,130,183,218,216,230,232,30,55,3,72,32,0,66,53,55,3,80,32,0,32,0,41,3,80,66,8,125,55,3,88,32,0,16,14,32,0,11,206,4,1,5,127,32,1,40,2,8,33,4,32,1,40,2,0,65,8,106,33,5,3,64,2,127,65,0,33,3,3,64,32,3,32,4,72,4,64,32,3,32,5,106,45,0,0,33,1,32,0,40,2,0,32,0,40,2,8,16,12,33,6,32,0,40,2,0,32,0,40,2,8,32,1,16,11,32,0,32,0,41,3,40,35,4,32,6,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,6,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,32,1,173,132,55,3,40,32,0,32,0,41,3,40,35,3,32,6,65,255,1,113,16,13,133,55,3,40,32,0,32,0,41,3,16,66,1,124,55,3,16,32,0,32,0,41,3,24,66,1,124,55,3,24,2,127,32,0,41,3,16,32,0,41,3,104,90,34,1,4,64,32,0,41,3,40,32,0,41,3,120,131,66,0,81,33,1,11,32,1,69,11,4,127,32,0,41,3,16,32,0,41,3,112,90,5,32,1,11,4,64,32,0,32,0,41,3,32,55,3,48,32,0,32,0,41,3,16,55,3,56,32,0,32,0,41,3,40,55,3,64,65,0,33,1,3,64,32,1,32,0,40,2,4,72,4,64,32,0,40,2,0,32,1,65,0,16,11,32,1,65,1,106,33,1,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,12,33,1,32,0,40,2,0,32,0,40,2,8,65,1,16,11,32,0,32,0,41,3,40,35,4,32,1,65,255,1,113,16,13,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,41,3,40,32,0,41,3,88,136,167,33,1,32,0,32,0,41,3,40,66,8,134,55,3,40,32,0,32,0,41,3,40,66,1,132,55,3,40,32,0,32,0,41,3,40,35,3,32,1,65,255,1,113,16,13,133,55,3,40,32,3,65,1,106,12,3,5,32,3,65,1,106,33,3,12,2,11,0,11,11,65,127,11,34,1,65,0,78,4,64,32,4,32,1,107,33,4,32,1,32,5,106,33,5,32,7,34,1,65,1,106,33,7,32,2,40,2,4,32,2,40,2,0,32,1,65,2,116,106,106,32,0,41,3,56,62,2,8,32,2,40,2,4,32,2,40,2,0,32,1,65,2,116,106,106,40,2,8,26,12,1,11,11,11,88,1,1,127,32,0,32,1,70,4,64,65,0,15,11,3,64,32,2,65,0,71,34,3,4,64,32,0,45,0,0,32,1,45,0,0,70,33,3,11,32,3,4,64,32,2,65,1,107,33,2,32,0,65,1,106,33,0,32,1,65,1,106,33,1,12,1,11,11,32,2,4,127,32,0,45,0,0,32,1,45,0,0,107,5,65,0,11,11,10,0,32,0,32,1,32,2,16,17,11,3,0,1,11,6,0,35,0,36,1,11,19,0,65,136,1,36,0,35,0,36,1,16,6,36,3,16,6,36,4,11,3,0,1,11,7,0,32,0,40,2,0,11,9,0,32,0,32,1,54,2,0,11,7,0,32,0,40,2,4,11,9,0,32,0,32,1,54,2,4,11,7,0,32,0,40,2,8,11,9,0,32,0,32,1,54,2,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,41,3,96,11,9,0,32,0,32,1,55,3,96,11,7,0,32,0,41,3,104,11,9,0,32,0,32,1,55,3,104,11,7,0,32,0,41,3,112,11,9,0,32,0,32,1,55,3,112,11,7,0,32,0,41,3,120,11,9,0,32,0,32,1,55,3,120,11,11,128,1,2,0,65,8,11,57,27,0,0,0,126,0,108,0,105,0,98,0,47,0,105,0,110,0,116,0,101,0,114,0,110,0,97,0,108,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,200,0,11,59,28,0,0,0,126,0,108,0,105,0,98,0,47,0,105,0,110,0,116,0,101,0,114,0,110,0,97,0,108,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,32,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,14,114,97,98,105,110,46,119,97,115,109,46,109,97,112]) | ||
var wasm = new Uint8Array([0,97,115,109,1,0,0,0,1,77,14,96,2,127,127,1,127,96,1,127,0,96,1,127,1,127,96,0,0,96,3,127,127,127,1,127,96,4,127,127,127,127,0,96,3,127,127,127,0,96,1,126,1,127,96,2,126,126,1,126,96,4,127,127,127,127,1,127,96,2,127,127,0,96,1,127,1,126,96,2,127,126,0,96,0,1,127,2,13,1,3,101,110,118,5,97,98,111,114,116,0,5,3,43,42,1,0,2,1,3,10,4,13,7,8,0,6,2,9,4,3,2,10,11,12,11,12,11,12,11,12,11,12,11,12,11,12,11,12,11,12,11,12,11,12,2,10,5,3,1,0,1,6,47,9,127,1,65,0,11,127,1,65,0,11,127,0,65,3,11,127,0,65,4,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,0,65,224,1,11,127,0,65,6,11,7,192,5,39,6,109,101,109,111,114,121,2,0,7,95,95,97,108,108,111,99,0,2,8,95,95,114,101,116,97,105,110,0,3,9,95,95,114,101,108,101,97,115,101,0,4,9,95,95,99,111,108,108,101,99,116,0,5,11,95,95,114,116,116,105,95,98,97,115,101,3,7,13,73,110,116,51,50,65,114,114,97,121,95,73,68,3,2,13,85,105,110,116,56,65,114,114,97,121,95,73,68,3,3,6,100,101,103,114,101,101,0,9,3,109,111,100,0,10,5,82,97,98,105,110,3,8,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,17,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,18,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,19,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,20,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,21,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,22,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,23,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,24,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,25,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,26,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,27,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,28,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,29,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,30,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,31,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,32,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,33,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,34,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,35,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,36,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,37,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,38,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,39,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,40,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,41,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,42,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,14,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,15,8,1,16,10,241,21,42,70,1,2,127,32,0,63,0,34,2,65,16,116,34,1,75,4,64,32,2,32,0,32,1,107,65,255,255,3,106,65,128,128,124,113,65,16,118,34,1,32,2,32,1,74,27,64,0,65,0,72,4,64,32,1,64,0,65,0,72,4,64,0,11,11,11,32,0,36,1,11,82,1,3,127,32,0,65,240,255,255,255,3,75,4,64,0,11,35,1,65,16,106,34,3,32,0,65,15,106,65,112,113,34,2,65,16,32,2,65,16,75,27,34,4,106,16,1,32,3,65,16,107,34,2,32,4,54,2,0,32,2,65,127,54,2,4,32,2,32,1,54,2,8,32,2,32,0,54,2,12,32,3,11,4,0,32,0,11,3,0,1,11,3,0,1,11,140,3,1,1,127,2,64,32,1,69,13,0,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,13,0,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,13,0,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,13,0,32,1,65,0,32,0,107,65,3,113,34,1,107,33,2,32,0,32,1,106,34,0,65,0,54,2,0,32,2,65,124,113,34,1,32,0,106,65,4,107,65,0,54,2,0,32,1,65,8,77,13,0,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,13,0,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,65,4,113,65,24,106,34,2,32,0,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,11,110,0,32,1,65,240,255,255,255,3,32,2,118,75,4,64,65,24,65,200,0,65,23,65,56,16,0,0,11,32,1,32,2,116,34,2,65,0,16,2,34,1,32,2,16,6,32,0,69,4,64,65,12,65,2,16,2,33,0,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,40,2,0,26,32,0,32,1,54,2,0,32,0,32,1,54,2,4,32,0,32,2,54,2,8,32,0,11,15,0,65,12,65,5,16,2,65,128,2,65,3,16,7,11,70,2,1,127,1,126,66,128,128,128,128,128,128,128,128,128,127,33,2,3,64,2,64,32,1,65,192,0,78,13,0,32,0,32,2,131,66,0,82,4,64,65,63,32,1,107,15,5,32,2,66,1,136,33,2,32,1,65,1,106,33,1,12,2,11,0,11,11,65,127,11,170,1,2,1,127,1,126,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,0,32,3,131,66,0,82,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,3,65,0,33,2,3,64,2,64,32,2,65,192,0,78,13,0,65,63,32,2,107,32,1,32,3,131,66,0,82,13,2,26,32,3,66,1,136,33,3,32,2,65,1,106,33,2,12,1,11,11,65,127,11,107,34,2,65,0,72,69,4,64,32,1,32,2,172,134,32,0,133,33,0,12,1,11,11,32,0,11,38,0,32,1,32,0,40,2,8,79,4,64,65,128,1,65,184,1,65,148,1,65,44,16,0,0,11,32,0,40,2,4,32,1,106,45,0,0,11,40,0,32,1,32,0,40,2,8,79,4,64,65,128,1,65,184,1,65,159,1,65,44,16,0,0,11,32,0,40,2,4,32,1,106,32,2,58,0,0,11,195,6,2,4,127,5,126,35,4,69,4,64,32,0,41,3,64,33,7,3,64,32,3,65,128,2,72,4,64,32,3,65,255,1,113,173,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,5,32,6,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,5,32,7,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,34,2,65,0,78,4,64,32,7,32,2,172,134,32,6,133,33,6,12,1,11,11,65,0,33,1,3,64,32,1,65,63,72,4,64,32,6,66,8,134,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,5,32,6,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,2,65,1,106,33,2,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,2,3,64,32,2,65,192,0,72,4,64,65,63,32,2,107,32,5,32,7,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,2,65,1,106,33,2,12,1,11,11,65,127,11,107,34,2,65,0,78,4,64,32,7,32,2,172,134,32,6,133,33,6,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,35,6,40,2,4,32,3,65,3,116,106,32,6,55,3,0,32,3,65,1,106,33,3,12,1,11,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,6,65,0,33,3,3,64,32,3,65,192,0,72,4,64,65,63,32,3,107,32,6,32,7,131,66,0,82,13,2,26,32,6,66,1,136,33,6,32,3,65,1,106,33,3,12,1,11,11,65,127,11,172,33,8,65,0,33,3,3,64,32,3,65,128,2,72,4,64,35,5,33,4,32,3,172,32,8,134,34,9,33,6,3,64,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,5,32,6,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,1,65,1,106,33,1,12,1,11,11,65,127,11,2,127,66,128,128,128,128,128,128,128,128,128,127,33,5,65,0,33,1,3,64,32,1,65,192,0,72,4,64,65,63,32,1,107,32,5,32,7,131,66,0,82,13,2,26,32,5,66,1,136,33,5,32,1,65,1,106,33,1,12,1,11,11,65,127,11,107,34,2,65,0,78,4,64,32,7,32,2,172,134,32,6,133,33,6,12,1,11,11,32,4,40,2,4,32,3,65,3,116,106,32,6,32,9,132,55,3,0,32,3,65,1,106,33,3,12,1,11,11,65,1,36,4,11,32,0,66,0,55,3,32,32,0,65,0,54,2,0,32,0,66,0,55,3,8,32,0,66,0,55,3,32,32,0,40,2,96,32,0,40,2,0,34,2,16,11,33,1,32,0,40,2,96,32,2,65,1,16,12,32,0,32,0,41,3,32,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,32,32,0,32,2,65,1,106,65,192,0,111,54,2,0,32,0,35,5,40,2,4,32,0,41,3,32,34,7,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,7,66,8,134,66,1,132,133,55,3,32,32,0,11,170,1,0,32,0,69,4,64,65,228,0,65,6,16,2,33,0,11,32,0,65,0,54,2,0,32,0,66,0,55,3,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,65,12,65,4,16,2,65,192,0,65,0,16,7,54,2,96,32,0,32,2,173,55,3,72,32,0,32,3,173,55,3,80,32,0,66,1,32,1,173,134,66,1,125,55,3,88,32,0,66,243,130,183,218,216,230,232,30,55,3,64,32,0,16,13,26,32,0,11,129,4,2,6,127,6,126,32,1,40,2,8,33,5,32,1,40,2,4,33,6,3,64,2,127,32,0,41,3,16,33,10,32,0,41,3,8,33,9,32,0,41,3,88,33,11,32,0,41,3,72,33,12,32,0,41,3,80,33,13,65,0,33,1,3,64,32,1,32,5,72,4,64,32,1,32,6,106,45,0,0,33,3,32,0,40,2,96,32,0,40,2,0,34,4,16,11,33,7,32,0,40,2,96,32,4,32,3,16,12,32,0,32,0,41,3,32,35,6,40,2,4,32,7,65,3,116,106,41,3,0,133,55,3,32,32,0,32,4,65,1,106,65,192,0,111,54,2,0,32,0,35,5,40,2,4,32,0,41,3,32,34,14,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,3,173,32,14,66,8,134,132,133,55,3,32,32,10,66,1,124,33,10,32,9,66,1,124,34,9,32,12,90,4,127,32,0,41,3,32,32,11,131,80,5,65,0,11,4,127,65,1,5,32,9,32,13,90,11,4,64,32,0,32,0,41,3,24,55,3,40,32,0,32,9,55,3,48,32,0,32,0,41,3,32,55,3,56,32,0,32,10,55,3,16,32,0,32,9,55,3,8,32,0,66,0,55,3,32,32,0,65,0,54,2,0,32,0,66,0,55,3,8,32,0,66,0,55,3,32,32,0,40,2,96,32,0,40,2,0,34,3,16,11,33,4,32,0,40,2,96,32,3,65,1,16,12,32,0,32,0,41,3,32,35,6,40,2,4,32,4,65,3,116,106,41,3,0,133,55,3,32,32,0,32,3,65,1,106,65,192,0,111,54,2,0,32,0,35,5,40,2,4,32,0,41,3,32,34,9,66,45,136,167,65,255,1,113,65,3,116,106,41,3,0,32,9,66,8,134,66,1,132,133,55,3,32,32,0,40,2,96,40,2,4,65,192,0,16,6,32,1,65,1,106,12,3,5,32,1,65,1,106,33,1,12,2,11,0,11,11,32,0,32,10,55,3,16,32,0,32,9,55,3,8,65,127,11,34,1,65,0,78,4,64,32,5,32,1,107,33,5,32,1,32,6,106,33,6,32,2,40,2,4,32,8,65,1,106,34,8,65,2,116,106,32,0,41,3,48,62,2,0,12,1,11,11,32,2,11,20,0,65,160,2,36,0,65,160,2,36,1,16,8,36,5,16,8,36,6,11,7,0,32,0,40,2,0,11,9,0,32,0,32,1,54,2,0,11,7,0,32,0,41,3,8,11,9,0,32,0,32,1,55,3,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,40,2,96,11,15,0,32,1,40,2,96,26,32,0,32,1,54,2,96,11,11,152,2,5,0,65,8,11,43,28,0,0,0,1,0,0,0,1,0,0,0,28,0,0,0,73,0,110,0,118,0,97,0,108,0,105,0,100,0,32,0,108,0,101,0,110,0,103,0,116,0,104,0,65,56,11,53,38,0,0,0,1,0,0,0,1,0,0,0,38,0,0,0,126,0,108,0,105,0,98,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,65,240,0,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,73,0,110,0,100,0,101,0,120,0,32,0,111,0,117,0,116,0,32,0,111,0,102,0,32,0,114,0,97,0,110,0,103,0,101,0,65,168,1,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,126,0,108,0,105,0,98,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,224,1,11,53,7,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,145,4,0,0,2,0,0,0,49,0,0,0,2,0,0,0,17,1,0,0,2,0,0,0,16,0,32,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,14,114,97,98,105,110,46,119,97,115,109,46,109,97,112]) | ||
// make it work async because browsers throw when a wasm module is bigger than 4kb and load sync | ||
@@ -17,23 +17,59 @@ return instantiateStreaming(new Response(new Blob([wasm], {type: 'application/wasm'})), imp) | ||
},{"assemblyscript/lib/loader":2}],2:[function(require,module,exports){ | ||
},{"@assemblyscript/loader":2}],2:[function(require,module,exports){ | ||
"use strict"; | ||
const hasBigInt64 = typeof BigUint64Array !== "undefined"; | ||
const thisPtr = Symbol(); | ||
// Runtime header offsets | ||
const ID_OFFSET = -8; | ||
const SIZE_OFFSET = -4; | ||
// Runtime ids | ||
const ARRAYBUFFER_ID = 0; | ||
const STRING_ID = 1; | ||
const ARRAYBUFFERVIEW_ID = 2; | ||
// Runtime type information | ||
const ARRAYBUFFERVIEW = 1 << 0; | ||
const ARRAY = 1 << 1; | ||
const SET = 1 << 2; | ||
const MAP = 1 << 3; | ||
const VAL_ALIGN_OFFSET = 5; | ||
const VAL_ALIGN = 1 << VAL_ALIGN_OFFSET; | ||
const VAL_SIGNED = 1 << 10; | ||
const VAL_FLOAT = 1 << 11; | ||
const VAL_NULLABLE = 1 << 12; | ||
const VAL_MANAGED = 1 << 13; | ||
const KEY_ALIGN_OFFSET = 14; | ||
const KEY_ALIGN = 1 << KEY_ALIGN_OFFSET; | ||
const KEY_SIGNED = 1 << 19; | ||
const KEY_FLOAT = 1 << 20; | ||
const KEY_NULLABLE = 1 << 21; | ||
const KEY_MANAGED = 1 << 22; | ||
// Array(BufferView) layout | ||
const ARRAYBUFFERVIEW_BUFFER_OFFSET = 0; | ||
const ARRAYBUFFERVIEW_DATASTART_OFFSET = 4; | ||
const ARRAYBUFFERVIEW_DATALENGTH_OFFSET = 8; | ||
const ARRAYBUFFERVIEW_SIZE = 12; | ||
const ARRAY_LENGTH_OFFSET = 12; | ||
const ARRAY_SIZE = 16; | ||
const BIGINT = typeof BigUint64Array !== "undefined"; | ||
const THIS = Symbol(); | ||
const CHUNKSIZE = 1024; | ||
/** Gets a string from an U32 and an U16 view on a memory. */ | ||
function getStringImpl(U32, U16, ptr) { | ||
var dataLength = U32[ptr >>> 2]; | ||
var dataOffset = (ptr + 4) >>> 1; | ||
var dataRemain = dataLength; | ||
var parts = []; | ||
const chunkSize = 1024; | ||
while (dataRemain > chunkSize) { | ||
let last = U16[dataOffset + chunkSize - 1]; | ||
let size = last >= 0xD800 && last < 0xDC00 ? chunkSize - 1 : chunkSize; | ||
let part = U16.subarray(dataOffset, dataOffset += size); | ||
parts.push(String.fromCharCode.apply(String, part)); | ||
dataRemain -= size; | ||
} | ||
return parts.join("") + String.fromCharCode.apply(String, U16.subarray(dataOffset, dataOffset + dataRemain)); | ||
function getStringImpl(buffer, ptr) { | ||
const U32 = new Uint32Array(buffer); | ||
const U16 = new Uint16Array(buffer); | ||
var length = U32[(ptr + SIZE_OFFSET) >>> 2] >>> 1; | ||
var offset = ptr >>> 1; | ||
if (length <= CHUNKSIZE) return String.fromCharCode.apply(String, U16.subarray(offset, offset + length)); | ||
const parts = []; | ||
do { | ||
const last = U16[offset + CHUNKSIZE - 1]; | ||
const size = last >= 0xD800 && last < 0xDC00 ? CHUNKSIZE - 1 : CHUNKSIZE; | ||
parts.push(String.fromCharCode.apply(String, U16.subarray(offset, offset += size))); | ||
length -= size; | ||
} while (length > CHUNKSIZE); | ||
return parts.join("") + String.fromCharCode.apply(String, U16.subarray(offset, offset + length)); | ||
} | ||
@@ -43,18 +79,17 @@ | ||
function preInstantiate(imports) { | ||
var baseModule = {}; | ||
const baseModule = {}; | ||
function getString(memory, ptr) { | ||
if (!memory) return "<yet unknown>"; | ||
var buffer = memory.buffer; | ||
return getStringImpl(new Uint32Array(buffer), new Uint16Array(buffer), ptr); | ||
return getStringImpl(memory.buffer, ptr); | ||
} | ||
// add common imports used by stdlib for convenience | ||
var env = (imports.env = imports.env || {}); | ||
const env = (imports.env = imports.env || {}); | ||
env.abort = env.abort || function abort(mesg, file, line, colm) { | ||
var memory = baseModule.memory || env.memory; // prefer exported, otherwise try imported | ||
const memory = baseModule.memory || env.memory; // prefer exported, otherwise try imported | ||
throw Error("abort: " + getString(memory, mesg) + " at " + getString(memory, file) + ":" + line + ":" + colm); | ||
} | ||
env.trace = env.trace || function trace(mesg, n) { | ||
var memory = baseModule.memory || env.memory; | ||
const memory = baseModule.memory || env.memory; | ||
console.log("trace: " + getString(memory, mesg) + (n ? " " : "") + Array.prototype.slice.call(arguments, 2, 2 + n).join(", ")); | ||
@@ -70,155 +105,187 @@ } | ||
function postInstantiate(baseModule, instance) { | ||
var rawExports = instance.exports; | ||
var memory = rawExports.memory; | ||
var memory_allocate = rawExports["memory.allocate"]; | ||
var memory_fill = rawExports["memory.fill"]; | ||
var memory_free = rawExports["memory.free"]; | ||
var table = rawExports.table; | ||
var setargc = rawExports._setargc || function() {}; | ||
const rawExports = instance.exports; | ||
const memory = rawExports.memory; | ||
const table = rawExports.table; | ||
const alloc = rawExports["__alloc"]; | ||
const retain = rawExports["__retain"]; | ||
const rttiBase = rawExports["__rtti_base"] || ~0; // oob if not present | ||
// Provide views for all sorts of basic values | ||
var buffer, I8, U8, I16, U16, I32, U32, F32, F64, I64, U64; | ||
/** Gets the runtime type info for the given id. */ | ||
function getInfo(id) { | ||
const U32 = new Uint32Array(memory.buffer); | ||
const count = U32[rttiBase >>> 2]; | ||
if ((id >>>= 0) >= count) throw Error("invalid id: " + id); | ||
return U32[(rttiBase + 4 >>> 2) + id * 2]; | ||
} | ||
/** Updates memory views if memory has grown meanwhile. */ | ||
function checkMem() { | ||
// see: https://github.com/WebAssembly/design/issues/1210 | ||
if (buffer !== memory.buffer) { | ||
buffer = memory.buffer; | ||
I8 = new Int8Array(buffer); | ||
U8 = new Uint8Array(buffer); | ||
I16 = new Int16Array(buffer); | ||
U16 = new Uint16Array(buffer); | ||
I32 = new Int32Array(buffer); | ||
U32 = new Uint32Array(buffer); | ||
if (hasBigInt64) { | ||
I64 = new BigInt64Array(buffer); | ||
U64 = new BigUint64Array(buffer); | ||
} | ||
F32 = new Float32Array(buffer); | ||
F64 = new Float64Array(buffer); | ||
} | ||
/** Gets the runtime base id for the given id. */ | ||
function getBase(id) { | ||
const U32 = new Uint32Array(memory.buffer); | ||
const count = U32[rttiBase >>> 2]; | ||
if ((id >>>= 0) >= count) throw Error("invalid id: " + id); | ||
return U32[(rttiBase + 4 >>> 2) + id * 2 + 1]; | ||
} | ||
checkMem(); | ||
/** Allocates a new string in the module's memory and returns its pointer. */ | ||
function newString(str) { | ||
var dataLength = str.length; | ||
var ptr = memory_allocate(4 + (dataLength << 1)); | ||
var dataOffset = (4 + ptr) >>> 1; | ||
checkMem(); | ||
U32[ptr >>> 2] = dataLength; | ||
for (let i = 0; i < dataLength; ++i) U16[dataOffset + i] = str.charCodeAt(i); | ||
return ptr; | ||
/** Gets the runtime alignment of a collection's values. */ | ||
function getValueAlign(info) { | ||
return 31 - Math.clz32((info >>> VAL_ALIGN_OFFSET) & 31); // -1 if none | ||
} | ||
baseModule.newString = newString; | ||
/** Gets the runtime alignment of a collection's keys. */ | ||
function getKeyAlign(info) { | ||
return 31 - Math.clz32((info >>> KEY_ALIGN_OFFSET) & 31); // -1 if none | ||
} | ||
/** Gets a string from the module's memory by its pointer. */ | ||
function getString(ptr) { | ||
checkMem(); | ||
return getStringImpl(U32, U16, ptr); | ||
/** Allocates a new string in the module's memory and returns its retained pointer. */ | ||
function __allocString(str) { | ||
const length = str.length; | ||
const ptr = alloc(length << 1, STRING_ID); | ||
const U16 = new Uint16Array(memory.buffer); | ||
for (var i = 0, p = ptr >>> 1; i < length; ++i) U16[p + i] = str.charCodeAt(i); | ||
return ptr; | ||
} | ||
baseModule.getString = getString; | ||
baseModule.__allocString = __allocString; | ||
function computeBufferSize(byteLength) { | ||
const HEADER_SIZE = 8; | ||
return 1 << (32 - Math.clz32(byteLength + HEADER_SIZE - 1)); | ||
/** Reads a string from the module's memory by its pointer. */ | ||
function __getString(ptr) { | ||
const buffer = memory.buffer; | ||
const id = new Uint32Array(buffer)[ptr + ID_OFFSET >>> 2]; | ||
if (id !== STRING_ID) throw Error("not a string: " + ptr); | ||
return getStringImpl(buffer, ptr); | ||
} | ||
/** Creates a new typed array in the module's memory and returns its pointer. */ | ||
function newArray(view, length, unsafe) { | ||
var ctor = view.constructor; | ||
if (ctor === Function) { // TypedArray constructor created in memory | ||
ctor = view; | ||
view = null; | ||
} else { // TypedArray instance copied into memory | ||
if (length === undefined) length = view.length; | ||
} | ||
var elementSize = ctor.BYTES_PER_ELEMENT; | ||
if (!elementSize) throw Error("not a typed array"); | ||
var byteLength = elementSize * length; | ||
var ptr = memory_allocate(12); // TypedArray header | ||
var buf = memory_allocate(computeBufferSize(byteLength)); // ArrayBuffer | ||
checkMem(); | ||
U32[ ptr >>> 2] = buf; // .buffer | ||
U32[(ptr + 4) >>> 2] = 0; // .byteOffset | ||
U32[(ptr + 8) >>> 2] = byteLength; // .byteLength | ||
U32[ buf >>> 2] = byteLength; // .byteLength | ||
U32[(buf + 4) >>> 2] = 0; // 0 | ||
if (view) { | ||
new ctor(buffer, buf + 8, length).set(view); | ||
if (view.length < length && !unsafe) { | ||
let setLength = elementSize * view.length; | ||
memory_fill(buf + 8 + setLength, 0, byteLength - setLength); | ||
baseModule.__getString = __getString; | ||
/** Gets the view matching the specified alignment, signedness and floatness. */ | ||
function getView(alignLog2, signed, float) { | ||
const buffer = memory.buffer; | ||
if (float) { | ||
switch (alignLog2) { | ||
case 2: return new Float32Array(buffer); | ||
case 3: return new Float64Array(buffer); | ||
} | ||
} else if (!unsafe) { | ||
memory_fill(buf + 8, 0, byteLength); | ||
} else { | ||
switch (alignLog2) { | ||
case 0: return new (signed ? Int8Array : Uint8Array)(buffer); | ||
case 1: return new (signed ? Int16Array : Uint16Array)(buffer); | ||
case 2: return new (signed ? Int32Array : Uint32Array)(buffer); | ||
case 3: return new (signed ? BigInt64Array : BigUint64Array)(buffer); | ||
} | ||
} | ||
return ptr; | ||
throw Error("unsupported align: " + alignLog2); | ||
} | ||
baseModule.newArray = newArray; | ||
/** Allocates a new array in the module's memory and returns its retained pointer. */ | ||
function __allocArray(id, values) { | ||
const info = getInfo(id); | ||
if (!(info & (ARRAYBUFFERVIEW | ARRAY))) throw Error("not an array: " + id + " @ " + info); | ||
const align = getValueAlign(info); | ||
const length = values.length; | ||
const buf = alloc(length << align, ARRAYBUFFER_ID); | ||
const arr = alloc(info & ARRAY ? ARRAY_SIZE : ARRAYBUFFERVIEW_SIZE, id); | ||
const U32 = new Uint32Array(memory.buffer); | ||
U32[arr + ARRAYBUFFERVIEW_BUFFER_OFFSET >>> 2] = retain(buf); | ||
U32[arr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2] = buf; | ||
U32[arr + ARRAYBUFFERVIEW_DATALENGTH_OFFSET >>> 2] = length << align; | ||
if (info & ARRAY) U32[arr + ARRAY_LENGTH_OFFSET >>> 2] = length; | ||
const view = getView(align, info & VAL_SIGNED, info & VAL_FLOAT); | ||
if (info & VAL_MANAGED) { | ||
for (let i = 0; i < length; ++i) view[(buf >>> align) + i] = retain(values[i]); | ||
} else { | ||
view.set(values, buf >>> align); | ||
} | ||
return arr; | ||
} | ||
/** Gets a view on a typed array in the module's memory by its pointer. */ | ||
function getArray(ctor, ptr) { | ||
var elementSize = ctor.BYTES_PER_ELEMENT; | ||
if (!elementSize) throw Error("not a typed array"); | ||
checkMem(); | ||
var buf = U32[ ptr >>> 2]; | ||
var byteOffset = U32[(ptr + 4) >>> 2]; | ||
var byteLength = U32[(ptr + 8) >>> 2]; | ||
return new ctor(buffer, buf + 8 + byteOffset, (byteLength - byteOffset) / elementSize); | ||
baseModule.__allocArray = __allocArray; | ||
/** Gets a view on the values of an array in the module's memory. */ | ||
function __getArrayView(arr) { | ||
const U32 = new Uint32Array(memory.buffer); | ||
const id = U32[arr + ID_OFFSET >>> 2]; | ||
const info = getInfo(id); | ||
if (!(info & ARRAYBUFFERVIEW)) throw Error("not an array: " + id); | ||
const align = getValueAlign(info); | ||
var buf = U32[arr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2]; | ||
const length = info & ARRAY | ||
? U32[arr + ARRAY_LENGTH_OFFSET >>> 2] | ||
: U32[buf + SIZE_OFFSET >>> 2] >>> align; | ||
return getView(align, info & VAL_SIGNED, info & VAL_FLOAT) | ||
.subarray(buf >>>= align, buf + length); | ||
} | ||
baseModule.getArray = getArray; | ||
baseModule.__getArrayView = __getArrayView; | ||
/** Frees a typed array in the module's memory. Must not be accessed anymore afterwards. */ | ||
function freeArray(ptr) { | ||
checkMem(); | ||
var buf = U32[ptr >>> 2]; | ||
memory_free(buf); | ||
memory_free(ptr); | ||
/** Reads (copies) the values of an array from the module's memory. */ | ||
function __getArray(arr) { | ||
const input = __getArrayView(arr); | ||
const len = input.length; | ||
const out = new Array(len); | ||
for (let i = 0; i < len; i++) out[i] = input[i]; | ||
return out; | ||
} | ||
baseModule.freeArray = freeArray; | ||
baseModule.__getArray = __getArray; | ||
/** | ||
* Creates a new function in the module's table and returns its pointer. Note that only actual | ||
* WebAssembly functions, i.e. as exported by the module, are supported. | ||
*/ | ||
function newFunction(fn) { | ||
if (typeof fn.original === "function") fn = fn.original; | ||
var index = table.length; | ||
table.grow(1); | ||
table.set(index, fn); | ||
return index; | ||
/** Reads (copies) the data of an ArrayBuffer from the module's memory. */ | ||
function __getArrayBuffer(ptr) { | ||
const buffer = memory.buffer; | ||
const length = new Uint32Array(buffer)[ptr + SIZE_OFFSET >>> 2]; | ||
return buffer.slice(ptr, ptr + length); | ||
} | ||
baseModule.newFunction = newFunction; | ||
baseModule.__getArrayBuffer = __getArrayBuffer; | ||
/** Gets a function by its pointer. */ | ||
function getFunction(ptr) { | ||
return wrapFunction(table.get(ptr), setargc); | ||
function getTypedArrayImpl(Type, alignLog2, ptr) { | ||
const buffer = memory.buffer; | ||
const U32 = new Uint32Array(buffer); | ||
const bufPtr = U32[ptr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2]; | ||
return new Type(buffer, bufPtr, U32[bufPtr + SIZE_OFFSET >>> 2] >>> alignLog2); | ||
} | ||
baseModule.getFunction = getFunction; | ||
/** Gets a view on the values of a known-to-be Int8Array in the module's memory. */ | ||
baseModule.__getInt8Array = getTypedArrayImpl.bind(null, Int8Array, 0); | ||
/** Gets a view on the values of a known-to-be Uint8Array in the module's memory. */ | ||
baseModule.__getUint8Array = getTypedArrayImpl.bind(null, Uint8Array, 0); | ||
/** Gets a view on the values of a known-to-be Uint8ClampedArray in the module's memory. */ | ||
baseModule.__getUint8ClampedArray = getTypedArrayImpl.bind(null, Uint8ClampedArray, 0); | ||
/** Gets a view on the values of a known-to-be Int16Array in the module's memory. */ | ||
baseModule.__getInt16Array = getTypedArrayImpl.bind(null, Int16Array, 1); | ||
/** Gets a view on the values of a known-to-be Uint16Array in the module's memory. */ | ||
baseModule.__getUint16Array = getTypedArrayImpl.bind(null, Uint16Array, 1); | ||
/** Gets a view on the values of a known-to-be Int32Array in the module's memory. */ | ||
baseModule.__getInt32Array = getTypedArrayImpl.bind(null, Int32Array, 2); | ||
/** Gets a view on the values of a known-to-be Uint32Array in the module's memory. */ | ||
baseModule.__getUint32Array = getTypedArrayImpl.bind(null, Uint32Array, 2); | ||
if (BIGINT) { | ||
/** Gets a view on the values of a known-to-be-Int64Array in the module's memory. */ | ||
baseModule.__getInt64Array = getTypedArrayImpl.bind(null, BigInt64Array, 3); | ||
/** Gets a view on the values of a known-to-be-Uint64Array in the module's memory. */ | ||
baseModule.__getUint64Array = getTypedArrayImpl.bind(null, BigUint64Array, 3); | ||
} | ||
/** Gets a view on the values of a known-to-be Float32Array in the module's memory. */ | ||
baseModule.__getFloat32Array = getTypedArrayImpl.bind(null, Float32Array, 2); | ||
/** Gets a view on the values of a known-to-be Float64Array in the module's memory. */ | ||
baseModule.__getFloat64Array = getTypedArrayImpl.bind(null, Float64Array, 3); | ||
/** Tests whether an object is an instance of the class represented by the specified base id. */ | ||
function __instanceof(ptr, baseId) { | ||
const U32 = new Uint32Array(memory.buffer); | ||
var id = U32[(ptr + ID_OFFSET) >>> 2]; | ||
if (id <= U32[rttiBase >>> 2]) { | ||
do if (id == baseId) return true; | ||
while (id = getBase(id)); | ||
} | ||
return false; | ||
} | ||
baseModule.__instanceof = __instanceof; | ||
// Pull basic exports to baseModule so code in preInstantiate can use them | ||
baseModule.memory = baseModule.memory || memory; | ||
baseModule.table = baseModule.table || table; | ||
baseModule.table = baseModule.table || table; | ||
// Demangle exports and provide the usual utility on the prototype | ||
return demangle(rawExports, Object.defineProperties(baseModule, { | ||
I8: { get: function() { checkMem(); return I8; } }, | ||
U8: { get: function() { checkMem(); return U8; } }, | ||
I16: { get: function() { checkMem(); return I16; } }, | ||
U16: { get: function() { checkMem(); return U16; } }, | ||
I32: { get: function() { checkMem(); return I32; } }, | ||
U32: { get: function() { checkMem(); return U32; } }, | ||
I64: { get: function() { checkMem(); return I64; } }, | ||
U64: { get: function() { checkMem(); return U64; } }, | ||
F32: { get: function() { checkMem(); return F32; } }, | ||
F64: { get: function() { checkMem(); return F64; } } | ||
})); | ||
return demangle(rawExports, baseModule); | ||
} | ||
@@ -232,4 +299,2 @@ | ||
} | ||
// adding a function to the table with `newFunction` is limited to actual WebAssembly functions, | ||
// hence we can't use the wrapper and instead need to provide a reference to the original | ||
wrap.original = fn; | ||
@@ -239,7 +304,17 @@ return wrap; | ||
/** Instantiates an AssemblyScript module using the specified imports. */ | ||
function instantiate(module, imports) { | ||
function isResponse(o) { | ||
return typeof Response !== "undefined" && o instanceof Response; | ||
} | ||
/** Asynchronously instantiates an AssemblyScript module from anything that can be instantiated. */ | ||
async function instantiate(source, imports) { | ||
if (isResponse(source = await source)) return instantiateStreaming(source, imports); | ||
return postInstantiate( | ||
preInstantiate(imports || (imports = {})), | ||
new WebAssembly.Instance(module, imports) | ||
await WebAssembly.instantiate( | ||
source instanceof WebAssembly.Module | ||
? source | ||
: await WebAssembly.compile(source), | ||
imports | ||
) | ||
); | ||
@@ -250,14 +325,30 @@ } | ||
/** Instantiates an AssemblyScript module from a buffer using the specified imports. */ | ||
function instantiateBuffer(buffer, imports) { | ||
return instantiate(new WebAssembly.Module(buffer), imports); | ||
/** Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer. */ | ||
function instantiateSync(source, imports) { | ||
return postInstantiate( | ||
preInstantiate(imports || (imports = {})), | ||
new WebAssembly.Instance( | ||
source instanceof WebAssembly.Module | ||
? source | ||
: new WebAssembly.Module(source), | ||
imports | ||
) | ||
) | ||
} | ||
exports.instantiateBuffer = instantiateBuffer; | ||
exports.instantiateSync = instantiateSync; | ||
/** Instantiates an AssemblyScript module from a response using the specified imports. */ | ||
async function instantiateStreaming(response, imports) { | ||
/** Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by `fetch`. */ | ||
async function instantiateStreaming(source, imports) { | ||
if (!WebAssembly.instantiateStreaming) { | ||
return instantiate( | ||
isResponse(source = await source) | ||
? source.arrayBuffer() | ||
: source, | ||
imports | ||
); | ||
} | ||
return postInstantiate( | ||
preInstantiate(imports || (imports = {})), | ||
(await WebAssembly.instantiateStreaming(response, imports)).instance | ||
(await WebAssembly.instantiateStreaming(source, imports)).instance | ||
); | ||
@@ -271,3 +362,3 @@ } | ||
var module = baseModule ? Object.create(baseModule) : {}; | ||
var setargc = exports._setargc || function() {}; | ||
var setargc = exports["__setargc"] || function() {}; | ||
function hasOwnProperty(elem, prop) { | ||
@@ -295,5 +386,9 @@ return Object.prototype.hasOwnProperty.call(elem, prop); | ||
}; | ||
ctor.prototype = {}; | ||
ctor.prototype = { | ||
valueOf: function valueOf() { | ||
return this[THIS]; | ||
} | ||
}; | ||
ctor.wrap = function(thisValue) { | ||
return Object.create(ctor.prototype, { [thisPtr]: { value: thisValue, writable: false } }); | ||
return Object.create(ctor.prototype, { [THIS]: { value: thisValue, writable: false } }); | ||
}; | ||
@@ -312,4 +407,4 @@ if (classElem) Object.getOwnPropertyNames(classElem).forEach(name => | ||
Object.defineProperty(curr, name, { | ||
get: function() { return getter(this[thisPtr]); }, | ||
set: function(value) { setter(this[thisPtr], value); }, | ||
get: function() { return getter(this[THIS]); }, | ||
set: function(value) { setter(this[THIS], value); }, | ||
enumerable: true | ||
@@ -325,3 +420,3 @@ }); | ||
setargc(args.length); | ||
return elem(this[thisPtr], ...args); | ||
return elem(this[THIS], ...args); | ||
} | ||
@@ -357,11 +452,10 @@ }); | ||
const create = async (bits, min, max, windowSize) => { | ||
const compiled = await getRabin() | ||
return new Rabin(bits, min, max, windowSize, compiled) | ||
const create = async (bits, min, max) => { | ||
const compiled = await getRabin() | ||
return new Rabin(compiled, bits, min, max) | ||
} | ||
module.exports = { | ||
Rabin, | ||
create | ||
Rabin, | ||
create, | ||
} | ||
@@ -384,3 +478,3 @@ | ||
*/ | ||
constructor(bits = 12, min = 8 * 1024, max = 32 * 1024, windowSize = 64, asModule) { | ||
constructor(asModule, bits = 12, min = 8 * 1024, max = 32 * 1024) { | ||
this.bits = bits | ||
@@ -390,3 +484,3 @@ this.min = min | ||
this.asModule = asModule | ||
this.rabin = new asModule.Rabin(bits, min, max, windowSize) | ||
this.rabin = new asModule.Rabin(bits, min, max) | ||
} | ||
@@ -401,25 +495,13 @@ | ||
*/ | ||
fingerprint(buf) { | ||
const lengths = new Int32Array(Math.ceil(buf.length/this.min)) | ||
const lengthsPtr = this.asModule.newArray(lengths) | ||
const pointer = this.asModule.newArray(buf) | ||
fingerprint(buffer) { | ||
const { __retain, __allocArray, __getInt32Array, Int32Array_ID, Uint8Array_ID } = this.asModule | ||
// run finderprint | ||
this.rabin.fingerprint(pointer, lengthsPtr) | ||
const lengths = new Int32Array(Math.ceil(buffer.length / this.min)) | ||
const lengthsPtr = __retain(__allocArray(Int32Array_ID, lengths)) | ||
const pointer = __retain(__allocArray(Uint8Array_ID, buffer)) | ||
const processed = this.asModule.getArray(Int32Array, lengthsPtr) | ||
// run fingerprint | ||
const processed = __getInt32Array(this.rabin.fingerprint(pointer, lengthsPtr)) | ||
//free memory | ||
this.asModule.freeArray(lengthsPtr) | ||
this.asModule.freeArray(pointer) | ||
// TODO: remove this. @see https://github.com/ipfs/js-ipfs/issues/2118#issuecomment-497722625 | ||
// clean extra 0s in the array | ||
const cleanArr = [] | ||
for (let i = 0; i < processed.length; i++) { | ||
if(processed[i] === 0) break | ||
cleanArr[i] = processed[i]; | ||
} | ||
return cleanArr | ||
return processed; | ||
} | ||
@@ -429,3 +511,4 @@ } | ||
module.exports = Rabin | ||
},{}]},{},[3])(3) | ||
}); |
{ | ||
"name": "rabin-wasm", | ||
"version": "0.0.8", | ||
"version": "0.1.0", | ||
"description": "Rabin fingerprinting implemented in AssemblyScript", | ||
@@ -22,6 +22,7 @@ "homepage": "https://github.com/hugomrdias/rabin-wasm", | ||
"scripts": { | ||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --validate --debug", | ||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat --sourceMap --validate --optimize", | ||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --runtime stub --sourceMap --validate --debug", | ||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat --runtime stub --sourceMap --validate -O3", | ||
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", | ||
"build": "asc assembly/index.ts -b dist/rabin.wasm -d dist/rabin.d.ts --sourceMap --validate -O3z && ./tools/wasm2js dist/rabin.wasm -o dist/rabin-wasm.js && browserify src/index.js -s Rabin -o dist/rabin.umd.js", | ||
"build": "asc assembly/index.ts -b dist/rabin.wasm -d dist/rabin.d.ts --sourceMap --validate --runtime stub -O3 && ./tools/wasm2js dist/rabin.wasm -o dist/rabin-wasm.js && browserify src/index.js -s Rabin -o dist/rabin.umd.js", | ||
"test": "asp --nortrace", | ||
"size": "size-limit dist/rabin.umd.js", | ||
@@ -35,11 +36,13 @@ "prepublishOnly": "npm run build" | ||
"dependencies": { | ||
"assemblyscript": "github:assemblyscript/assemblyscript#v0.6", | ||
"bl": "^1.0.0", | ||
"@assemblyscript/loader": "^0.8.1-nightly.20200101", | ||
"bl": "^4.0.0", | ||
"debug": "^4.1.1", | ||
"minimist": "^1.2.0", | ||
"node-fetch": "^2.6.0", | ||
"readable-stream": "^2.0.4" | ||
"readable-stream": "^3.4.0" | ||
}, | ||
"devDependencies": { | ||
"as-pect": "github:jtenner/as-pect#52ed8fd923d0ad96a07fe1b52de6c51d49e3b246", | ||
"@as-pect/cli": "^2.5.0", | ||
"@size-limit/preset-small-lib": "^4.2.1", | ||
"assemblyscript": "^0.8.1-nightly.20200101", | ||
"benchmark": "^2.1.4", | ||
@@ -49,6 +52,6 @@ "browserify": "^16.3.0", | ||
"long": "^4.0.0", | ||
"np": "^5.0.2", | ||
"rabin": "^1.6.0", | ||
"size-limit": "^1.3.5" | ||
"np": "^6.2.0", | ||
"rabin": "^2.0.0", | ||
"size-limit": "^4.2.1" | ||
} | ||
} |
const Rabin = require('./rabin') | ||
const getRabin = require('../dist/rabin-wasm.node.js') | ||
const create = async (bits, min, max, windowSize) => { | ||
const compiled = await getRabin() | ||
return new Rabin(bits, min, max, windowSize, compiled) | ||
const create = async (bits, min, max) => { | ||
const compiled = await getRabin() | ||
return new Rabin(compiled, bits, min, max) | ||
} | ||
module.exports = { | ||
Rabin, | ||
create | ||
Rabin, | ||
create, | ||
} |
@@ -15,3 +15,3 @@ /** | ||
*/ | ||
constructor(bits = 12, min = 8 * 1024, max = 32 * 1024, windowSize = 64, asModule) { | ||
constructor(asModule, bits = 12, min = 8 * 1024, max = 32 * 1024) { | ||
this.bits = bits | ||
@@ -21,3 +21,3 @@ this.min = min | ||
this.asModule = asModule | ||
this.rabin = new asModule.Rabin(bits, min, max, windowSize) | ||
this.rabin = new asModule.Rabin(bits, min, max) | ||
} | ||
@@ -32,28 +32,16 @@ | ||
*/ | ||
fingerprint(buf) { | ||
const lengths = new Int32Array(Math.ceil(buf.length/this.min)) | ||
const lengthsPtr = this.asModule.newArray(lengths) | ||
const pointer = this.asModule.newArray(buf) | ||
fingerprint(buffer) { | ||
const { __retain, __allocArray, __getInt32Array, Int32Array_ID, Uint8Array_ID } = this.asModule | ||
// run finderprint | ||
this.rabin.fingerprint(pointer, lengthsPtr) | ||
const lengths = new Int32Array(Math.ceil(buffer.length / this.min)) | ||
const lengthsPtr = __retain(__allocArray(Int32Array_ID, lengths)) | ||
const pointer = __retain(__allocArray(Uint8Array_ID, buffer)) | ||
const processed = this.asModule.getArray(Int32Array, lengthsPtr) | ||
// run fingerprint | ||
const processed = __getInt32Array(this.rabin.fingerprint(pointer, lengthsPtr)) | ||
//free memory | ||
this.asModule.freeArray(lengthsPtr) | ||
this.asModule.freeArray(pointer) | ||
// TODO: remove this. @see https://github.com/ipfs/js-ipfs/issues/2118#issuecomment-497722625 | ||
// clean extra 0s in the array | ||
const cleanArr = [] | ||
for (let i = 0; i < processed.length; i++) { | ||
if(processed[i] === 0) break | ||
cleanArr[i] = processed[i]; | ||
} | ||
return cleanArr | ||
return processed; | ||
} | ||
} | ||
module.exports = Rabin | ||
module.exports = Rabin |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
175418
0
10
714
2
+ Added@assemblyscript/loader@0.8.1(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedstring_decoder@1.3.0(transitive)
- Removedassemblyscript@github:assemblyscript/assemblyscript#v0.6
- Removedbl@1.2.3(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedisarray@1.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
Updatedbl@^4.0.0
Updatedreadable-stream@^3.4.0