@learncard/ethereum-plugin 1.1.31 → 1.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3617,7 +3617,10 @@ var require_bn = __commonJS({
3617
3617
  this.words[i] = carry;
3618
3618
  this.length++;
3619
3619
  }
3620
- this.length = num === 0 ? 1 : this.length;
3620
+ if (num === 0) {
3621
+ this.length = 1;
3622
+ this._normSign();
3623
+ }
3621
3624
  return isNegNum ? this.ineg() : this;
3622
3625
  }, "imuln");
3623
3626
  BN3.prototype.muln = /* @__PURE__ */ __name(function muln(num) {
@@ -4010,12 +4013,14 @@ var require_bn = __commonJS({
4010
4013
  BN3.prototype.divRound = /* @__PURE__ */ __name(function divRound(num) {
4011
4014
  var dm = this.divmod(num);
4012
4015
  if (dm.mod.isZero()) return dm.div;
4013
- var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
4014
- var half = num.ushrn(1);
4015
- var r2 = num.andln(1);
4016
+ var mod = dm.mod.abs();
4017
+ var half = num.abs().iushrn(1);
4018
+ var r2 = num.words[0] & 1;
4016
4019
  var cmp = mod.cmp(half);
4017
4020
  if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
4018
- return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
4021
+ var up = new BN3(1);
4022
+ up.negative = this.negative ^ num.negative;
4023
+ return dm.div.iadd(up);
4019
4024
  }, "divRound");
4020
4025
  BN3.prototype.modrn = /* @__PURE__ */ __name(function modrn(num) {
4021
4026
  var isNegNum = num < 0;