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