bireader 1.0.34 → 1.0.36
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.d.ts.map +1 -1
- package/lib/cjs/index.js +7 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/index.mjs +7 -4
- package/package.json +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -44,8 +44,10 @@ export function checkSize(_this, write_bytes, write_bit, offset) {
|
|
|
44
44
|
return new_off;
|
|
45
45
|
}
|
|
46
46
|
export function skip(_this, bytes, bits) {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
var new_size = (((bytes || 0) + _this.offset) + Math.ceil((_this.bitoffset + (bits || 0)) / 8));
|
|
48
|
+
if (bits && bits < 0) {
|
|
49
|
+
new_size = Math.floor(((((bytes || 0) + _this.offset) * 8) + _this.bitoffset + (bits || 0)) / 8);
|
|
50
|
+
}
|
|
49
51
|
if (new_size > _this.size) {
|
|
50
52
|
if (_this.strict == false) {
|
|
51
53
|
_this.extendArray(new_size - _this.size);
|
|
@@ -55,8 +57,9 @@ export function skip(_this, bytes, bits) {
|
|
|
55
57
|
throw new Error("\x1b[33m[Strict mode]\x1b[0m: Seek of range of data: seek " + new_size + " of " + _this.size);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
|
-
_this.
|
|
59
|
-
_this.
|
|
60
|
+
const total_bits = (((bytes || 0) + _this.offset) * 8) + (bits || 0) + _this.bitoffset;
|
|
61
|
+
_this.bitoffset = total_bits % 8;
|
|
62
|
+
_this.offset = Math.floor(total_bits / 8);
|
|
60
63
|
}
|
|
61
64
|
export function goto(_this, byte, bit) {
|
|
62
65
|
const new_size = (byte + Math.ceil((bit || 0) / 8));
|