Negative numbers and fix in comparator
This commit is contained in:
parent
cf6d1f0bb1
commit
273ab79665
@ -46,12 +46,11 @@ template CompConstant(ct) {
|
|||||||
slsb = in[i*2];
|
slsb = in[i*2];
|
||||||
smsb = in[i*2+1];
|
smsb = in[i*2+1];
|
||||||
|
|
||||||
|
if ((cmsb==0)&&(clsb==0)) {
|
||||||
if ((cmsb==0)&(clsb==0)) {
|
|
||||||
parts[i] <== -b*smsb*slsb + b*smsb + b*slsb;
|
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;
|
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;
|
parts[i] <== b*smsb*slsb - a*smsb + a;
|
||||||
} else {
|
} else {
|
||||||
parts[i] <== -a*smsb*slsb + a;
|
parts[i] <== -a*smsb*slsb + a;
|
||||||
|
@ -61,7 +61,7 @@ function sqrt(n) {
|
|||||||
r = r*b;
|
r = r*b;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r > ((-1) >> 1)) {
|
if (r < 0 ) {
|
||||||
r = -r;
|
r = -r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,8 +104,6 @@ describe("SMT Processor test", function () {
|
|||||||
await testInsert(tree, key, value, circuit);
|
await testInsert(tree, key, value, circuit);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
it("Should remove an element", async () => {
|
it("Should remove an element", async () => {
|
||||||
await testDelete(tree, 111, circuit);
|
await testDelete(tree, 111, circuit);
|
||||||
await testDelete(tree, 333, circuit);
|
await testDelete(tree, 333, circuit);
|
||||||
@ -207,5 +205,4 @@ describe("SMT Processor test", function () {
|
|||||||
await testUpdate(tree1, 9, 999, circuit);
|
await testUpdate(tree1, 9, 999, circuit);
|
||||||
await testUpdate(tree1, 32, 323232, circuit);
|
await testUpdate(tree1, 32, 323232, circuit);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user