Set up monorepo
Signed-off-by: T-Hax <>
This commit is contained in:
commit
6006120e60
357 changed files with 72219 additions and 0 deletions
25
@tornado/websnark/test/helpers/helpers.js
Normal file
25
@tornado/websnark/test/helpers/helpers.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const bigInt = require("big-integer");
|
||||
|
||||
function genValues(n, neg, bitsPerWord) {
|
||||
bitsPerWord = bitsPerWord || 32;
|
||||
const res = [];
|
||||
res.push(bigInt.zero);
|
||||
for (let i=0; i<n; i++) {
|
||||
if (i>0) {
|
||||
res.push( bigInt.one.shiftLeft(bitsPerWord*i).minus(1));
|
||||
}
|
||||
if (i<n-1) {
|
||||
res.push( bigInt.one.shiftLeft(bitsPerWord*i));
|
||||
res.push( bigInt.one.shiftLeft(bitsPerWord*i).add(1));
|
||||
}
|
||||
}
|
||||
|
||||
if (neg) {
|
||||
const nt= res.length;
|
||||
for (let i=0; i<nt; i++) res.push(bigInt.zero.minus(res[i]));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
module.exports.genValues = genValues;
|
Loading…
Add table
Add a link
Reference in a new issue