Negative numbers and fix in comparator

This commit is contained in:
Jordi Baylina 2020-03-16 20:41:11 +01:00
parent cf6d1f0bb1
commit 273ab79665
No known key found for this signature in database
GPG Key ID: 7480C80C1BE43112
3 changed files with 4 additions and 8 deletions

@ -46,12 +46,11 @@ template CompConstant(ct) {
slsb = in[i*2];
smsb = in[i*2+1];
if ((cmsb==0)&(clsb==0)) {
if ((cmsb==0)&&(clsb==0)) {
parts[i] <== -b*smsb*slsb + b*smsb + b*slsb;
} else if ((cmsb==0)&(clsb==1)) {
} else if ((cmsb==0)&&(clsb==1)) {
parts[i] <== a*smsb*slsb - a*slsb + b*smsb - a*smsb + a;
} else if ((cmsb==1)&(clsb==0)) {
} else if ((cmsb==1)&&(clsb==0)) {
parts[i] <== b*smsb*slsb - a*smsb + a;
} else {
parts[i] <== -a*smsb*slsb + a;

@ -61,7 +61,7 @@ function sqrt(n) {
r = r*b;
}
if (r > ((-1) >> 1)) {
if (r < 0 ) {
r = -r;
}

@ -104,8 +104,6 @@ describe("SMT Processor test", function () {
await testInsert(tree, key, value, circuit);
});
it("Should remove an element", async () => {
await testDelete(tree, 111, circuit);
await testDelete(tree, 333, circuit);
@ -207,5 +205,4 @@ describe("SMT Processor test", function () {
await testUpdate(tree1, 9, 999, circuit);
await testUpdate(tree1, 32, 323232, circuit);
});
});