bireader 1.0.52 → 1.0.54

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.
package/lib/esm/index.mjs CHANGED
@@ -734,7 +734,7 @@ function fNumber(_this, targetNumber, bits, unsigned, endian) {
734
734
  }
735
735
  }
736
736
  if (value === targetNumber) {
737
- return z; // Found the byte, return the index
737
+ return z - _this.offset; // Found the byte, return the index from current
738
738
  }
739
739
  }
740
740
  return -1; // number not found
@@ -1228,7 +1228,9 @@ function wfloat(_this, value, endian) {
1228
1228
  _this.errorDump ? "[Error], hexdump:\n" + _this.hexdump() : "";
1229
1229
  throw new Error('Value is out of range for the specified float length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
1230
1230
  }
1231
- let intValue = Float32Array.from([value])[0]; // Convert float to 32-bit integer representation
1231
+ const dataView = new DataView(new Uint8Array(4).buffer);
1232
+ dataView.setFloat32(0, value, true);
1233
+ let intValue = dataView.getInt32(0, true);
1232
1234
  let shift = 0;
1233
1235
  for (let i = 0; i < 4; i++) {
1234
1236
  if ((endian = undefined ? endian : _this.endian) == "little") {