multimath
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -0,1 +1,8 @@ | ||
1.0.3 / 2018-03-05 | ||
------------------ | ||
- Improve WebAssembly detection, #4. Workaround for broken WebAssembly in | ||
IOS 11.2.x Safary/Chrome (Webkit). | ||
1.0.2 / 2017-10-13 | ||
@@ -2,0 +9,0 @@ ------------------ |
@@ -8,9 +8,2 @@ // Detect WebAssembly support. | ||
var base64decode = require('./base64decode'); | ||
// See support/wa_detect/detect.c | ||
// Dummy module with `function detect() { return 1; }` | ||
var detector_src = 'AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAgEABAQBcAAABwoBBmRldGVjdAAACQEACgYBBABBAQs='; | ||
var wa; | ||
@@ -29,16 +22,14 @@ | ||
try { | ||
var module = new WebAssembly.Module(base64decode(detector_src)); | ||
// https://github.com/brion/min-wasm-fail/blob/master/min-wasm-fail.in.js | ||
// Additional check that WA internals are correct | ||
var env = { | ||
memoryBase: 0, | ||
memory: new WebAssembly.Memory({ initial: 1 }), | ||
tableBase: 0, | ||
table: new WebAssembly.Table({ initial: 0, element: 'anyfunc' }) | ||
}; | ||
/* eslint-disable comma-spacing, max-len */ | ||
var bin = new Uint8Array([ 0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11 ]); | ||
var module = new WebAssembly.Module(bin); | ||
var instance = new WebAssembly.Instance(module, {}); | ||
var instance = new WebAssembly.Instance(module, { env: env }); | ||
var detect = instance.exports.detect; | ||
// test storing to and loading from a non-zero location via a parameter. | ||
// Safari on iOS 11.2.5 returns 0 unexpectedly at non-zero locations | ||
if (instance.exports.test(4) !== 0) wa = true; | ||
if (detect() === 1) wa = true; | ||
return wa; | ||
@@ -45,0 +36,0 @@ } catch (__) {} |
{ | ||
"name": "multimath", | ||
"description": "Core to create fast image math in WebAssembly and JS.", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "webassembly", |
@@ -10,3 +10,3 @@ multimath | ||
`multimath` simplifies creation of small CPU-intensive webassembly modules | ||
with fallback to javascript implementations. | ||
with fallback to JavaScript implementations. | ||
@@ -17,3 +17,3 @@ - It cares about modules init, memory management and other things. | ||
Built-in functions (curently - unsharp mask) avalable as example for your | ||
Built-in functions (curently - unsharp mask) are available as examples for your | ||
extensions. | ||
@@ -20,0 +20,0 @@ |
62487
352