This commit is contained in:
Jordi Baylina
2020-08-13 18:56:30 +02:00
parent 7239abcef1
commit 4b631994ca
7 changed files with 207 additions and 145 deletions

View File

@@ -134,7 +134,7 @@ async function compile(srcFile, options) {
measures.generateC = -performance.now();
ctx.builder = new BuilderC(options.prime, ctx.verbose);
build(ctx);
await ctx.builder.build(options.cSourceFile);
await ctx.builder.build(options.cSourceFile, options.dataFile);
measures.generateC += performance.now();
}

View File

@@ -10,6 +10,7 @@ module.exports.fnvHash = fnvHash;
module.exports.sameSizes = sameSizes;
module.exports.isDefined = isDefined;
module.exports.accSizes2Str = accSizes2Str;
module.exports.setUint64 = setUint64;
function ident(text) {
if (typeof text === "string") {
@@ -90,6 +91,14 @@ function accSizes2Str(sizes) {
return `[${sizes[0]/sizes[1]}]`+accSizes2Str(sizes.slice(1));
}
function setUint64(buffV, o, n) {
const sLSB = n >>> 0;
const sMSB = (n - sLSB) / 0x100000000;
buffV.setUint32(o, sLSB , true);
buffV.setUint32(o+4, sMSB , true);
}