wonder.js
Version:
62 lines (48 loc) • 1.51 kB
JavaScript
;
var Caml_int32 = require("bs-platform/lib/js/caml_int32.js");
var Worker$Wonderjs = require("../../../../../external/Worker.js");
function getBufferMaxCount(param) {
return 4;
}
function getColorsSize(param) {
return 3;
}
function getIntensitiesSize(param) {
return 1;
}
function getColorIndex(index) {
return Caml_int32.imul(index, 3);
}
function getIntensityIndex(index) {
return (index << 0);
}
function getColorsOffset(count) {
return 0;
}
function getColorsLength(count) {
return Caml_int32.imul(count, 3);
}
function getIntensitiesOffset(count) {
return 0 + Caml_int32.imul(Caml_int32.imul(count, 3), Float32Array.BYTES_PER_ELEMENT) | 0;
}
function getIntensitiesLength(count) {
return (count << 0);
}
function getTotalByteLength(count) {
return (Caml_int32.imul(count, Float32Array.BYTES_PER_ELEMENT) << 2);
}
function createBuffer(count) {
return Worker$Wonderjs.newSharedArrayBuffer(getTotalByteLength(count));
}
exports.getBufferMaxCount = getBufferMaxCount;
exports.getColorsSize = getColorsSize;
exports.getIntensitiesSize = getIntensitiesSize;
exports.getColorIndex = getColorIndex;
exports.getIntensityIndex = getIntensityIndex;
exports.getColorsOffset = getColorsOffset;
exports.getColorsLength = getColorsLength;
exports.getIntensitiesOffset = getIntensitiesOffset;
exports.getIntensitiesLength = getIntensitiesLength;
exports.getTotalByteLength = getTotalByteLength;
exports.createBuffer = createBuffer;
/* Worker-Wonderjs Not a pure module */