Skip to content

Commit 3bd119e

Browse files
committed
Adapt to golden
1 parent 5c1145d commit 3bd119e

6 files changed

Lines changed: 36 additions & 4 deletions

File tree

build/main.cjs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,7 @@ class ZqField$1 {
18251825
buildSqrt(this);
18261826

18271827
this.FFT = new FFT(this, this, this.mul.bind(this));
1828+
this.shift = this.square(this.nqr);
18281829
}
18291830

18301831
e(a,b) {
@@ -2057,8 +2058,9 @@ class ZqField$1 {
20572058
}
20582059

20592060
toString(a, base) {
2061+
base = base || 10;
20602062
let vs;
2061-
if (a > this.half) {
2063+
if ((a > this.half)&&(base == 10)) {
20622064
const v = this.p-a;
20632065
vs = "-"+v.toString(base);
20642066
} else {
@@ -2134,6 +2136,8 @@ class ZqField {
21342136
buildSqrt(this);
21352137

21362138
this.FFT = new FFFT(this, this, this.mul.bind(this));
2139+
2140+
this.shift = this.square(this.nqr);
21372141
}
21382142

21392143
e(a,b) {
@@ -2348,8 +2352,9 @@ class ZqField {
23482352
}
23492353

23502354
toString(a, base) {
2355+
base = base || 10;
23512356
let vs;
2352-
if (!a.lesserOrEquals(this.p.shiftRight(bigInt__default["default"](1)))) {
2357+
if ((!a.lesserOrEquals(this.p.shiftRight(bigInt__default["default"](1))))&&(base==10)) {
23532358
const v = this.p.minus(a);
23542359
vs = "-"+v.toString(base);
23552360
} else {
@@ -2434,6 +2439,10 @@ class F1Field extends _F1Field {
24342439
return this.mul(this.fromRprBE(buff, o), this.Ri);
24352440
}
24362441

2442+
toObject(a) {
2443+
return a;
2444+
}
2445+
24372446
}
24382447

24392448
/*
@@ -2667,6 +2676,10 @@ class F2Field {
26672676
return [c0, c1];
26682677
}
26692678

2679+
toObject(a) {
2680+
return a;
2681+
}
2682+
26702683
}
26712684

26722685
/*
@@ -2947,6 +2960,9 @@ class F3Field {
29472960
return [c0, c1, c2];
29482961
}
29492962

2963+
toObject(a) {
2964+
return a;
2965+
}
29502966
}
29512967

29522968
/*

src/f1field.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,9 @@ export default class F1Field extends _F1Field {
5151
return this.mul(this.fromRprBE(buff, o), this.Ri);
5252
}
5353

54+
toObject(a) {
55+
return a;
56+
}
57+
5458
}
5559

src/f1field_bigint.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export default class ZqField {
4343
buildSqrt(this);
4444

4545
this.FFT = new FFFT(this, this, this.mul.bind(this));
46+
47+
this.shift = this.square(this.nqr);
4648
}
4749

4850
e(a,b) {
@@ -257,8 +259,9 @@ export default class ZqField {
257259
}
258260

259261
toString(a, base) {
262+
base = base || 10;
260263
let vs;
261-
if (!a.lesserOrEquals(this.p.shiftRight(bigInt(1)))) {
264+
if ((!a.lesserOrEquals(this.p.shiftRight(bigInt(1))))&&(base==10)) {
262265
const v = this.p.minus(a);
263266
vs = "-"+v.toString(base);
264267
} else {

src/f1field_native.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default class ZqField {
4646
buildSqrt(this);
4747

4848
this.FFT = new FFFT(this, this, this.mul.bind(this));
49+
this.shift = this.square(this.nqr);
4950
}
5051

5152
e(a,b) {
@@ -278,8 +279,9 @@ export default class ZqField {
278279
}
279280

280281
toString(a, base) {
282+
base = base || 10;
281283
let vs;
282-
if (a > this.half) {
284+
if ((a > this.half)&&(base == 10)) {
283285
const v = this.p-a;
284286
vs = "-"+v.toString(base);
285287
} else {

src/f2field.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,9 @@ export default class F2Field {
232232
return [c0, c1];
233233
}
234234

235+
toObject(a) {
236+
return a;
237+
}
238+
235239
}
236240

src/f3field.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,7 @@ export default class F3Field {
278278
return [c0, c1, c2];
279279
}
280280

281+
toObject(a) {
282+
return a;
283+
}
281284
}

0 commit comments

Comments
 (0)