@blackglory/structures 0.10.5 → 0.10.6

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.
@@ -16983,7 +16983,7 @@
16983
16983
  for (let bit = 0; bit < BitSet.bitsPerElement; bit++) {
16984
16984
  const mask = this.getMask(bit);
16985
16985
  if ((element & mask) === mask) {
16986
- yield index * 8 + bit;
16986
+ yield index * BitSet.bitsPerElement + bit;
16987
16987
  }
16988
16988
  }
16989
16989
  }
@@ -16991,18 +16991,17 @@
16991
16991
  for (let bit = 0; bit < remainder; bit++) {
16992
16992
  const mask = this.getMask(bit);
16993
16993
  if ((lastElement & mask) === mask) {
16994
- yield lastIndex * 8 + bit;
16994
+ yield lastIndex * BitSet.bitsPerElement + bit;
16995
16995
  }
16996
16996
  }
16997
16997
  }
16998
16998
  }
16999
16999
  _dumpBinaryStrings() {
17000
17000
  const result = [];
17001
- const expectedBinaryStringLength = Uint8Array.BYTES_PER_ELEMENT * 8;
17002
17001
  for (let i = 0; i < this.array.length; i++) {
17003
17002
  const binary = this.array.internalTypedArray[i].toString(2);
17004
- if (binary.length < expectedBinaryStringLength) {
17005
- result.push('0'.repeat(expectedBinaryStringLength - binary.length) + binary);
17003
+ if (binary.length < BitSet.bitsPerElement) {
17004
+ result.push('0'.repeat(BitSet.bitsPerElement - binary.length) + binary);
17006
17005
  }
17007
17006
  else {
17008
17007
  result.push(binary);
@@ -17012,7 +17011,7 @@
17012
17011
  }
17013
17012
  has(value) {
17014
17013
  var _a;
17015
- const { index, mask } = this.getPosition(value);
17014
+ const [index, mask] = this.getPosition(value);
17016
17015
  return (((_a = this.array.get(index)) !== null && _a !== void 0 ? _a : 0) & mask) === mask;
17017
17016
  }
17018
17017
  add(value) {
@@ -17021,12 +17020,12 @@
17021
17020
  if (value >= this.length) {
17022
17021
  this.length = value + 1;
17023
17022
  }
17024
- const { index, mask } = this.getPosition(value);
17023
+ const [index, mask] = this.getPosition(value);
17025
17024
  this.array.set(index, ((_a = this.array.get(index)) !== null && _a !== void 0 ? _a : 0) | mask);
17026
17025
  }
17027
17026
  delete(value) {
17028
17027
  var _a;
17029
- const { index, mask } = this.getPosition(value);
17028
+ const [index, mask] = this.getPosition(value);
17030
17029
  this.array.set(index, ((_a = this.array.get(index)) !== null && _a !== void 0 ? _a : 0) & ~mask);
17031
17030
  }
17032
17031
  clear() {
@@ -17039,7 +17038,7 @@
17039
17038
  const quotient = (value - remainder) / BitSet.bitsPerElement;
17040
17039
  const index = quotient;
17041
17040
  const mask = this.getMask(remainder);
17042
- return { index, mask };
17041
+ return [index, mask];
17043
17042
  }
17044
17043
  // 输入一定是一个小于bitsPerElement的值, 取值范围是[0, bitsPerElement)
17045
17044
  getMask(value) {