@sswroom/sswr 1.6.10 → 1.6.11

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/data.js CHANGED
@@ -297,16 +297,46 @@ export function readMUInt24(arr, index)
297
297
  return arr[index + 2] | (arr[index + 1] << 8) | (arr[index + 0] << 16);
298
298
  }
299
299
 
300
+ /**
301
+ * @param {Uint8Array} arr
302
+ * @param {number} index
303
+ * @returns {number}
304
+ */
300
305
  export function readUInt32(arr, index)
301
306
  {
302
307
  return arr[index] | (arr[index + 1] << 8) | (arr[index + 2] << 16) | (arr[index + 3] << 24);
303
308
  }
304
309
 
310
+ /**
311
+ * @param {Uint8Array} arr
312
+ * @param {number} index
313
+ * @returns {number}
314
+ */
305
315
  export function readMUInt32(arr, index)
306
316
  {
307
317
  return arr[index + 3] | (arr[index + 2] << 8) | (arr[index + 1] << 16) | (arr[index + 0] << 24);
308
318
  }
309
319
 
320
+ /**
321
+ * @param {Uint8Array} arr
322
+ * @param {number} index
323
+ * @returns {bigint}
324
+ */
325
+ export function readUInt64(arr, index)
326
+ {
327
+ return BigInt(readUInt32(arr, index)) + (BigInt(readUInt32(arr, index + 4)) << 32n);
328
+ }
329
+
330
+ /**
331
+ * @param {Uint8Array} arr
332
+ * @param {number} index
333
+ * @returns {bigint}
334
+ */
335
+ export function readMUInt64(arr, index)
336
+ {
337
+ return (BigInt(readUInt32(arr, index)) << 32n) + BigInt(readUInt32(arr, index + 4));
338
+ }
339
+
310
340
  export function rol32(v, n)
311
341
  {
312
342
  if (n == 0)
@@ -2524,16 +2554,27 @@ export class ByteReader
2524
2554
  return new Uint8Array(this.getArrayBuffer(ofst, size));
2525
2555
  }
2526
2556
 
2557
+ /**
2558
+ * @param {number} ofst
2559
+ */
2527
2560
  readUInt8(ofst)
2528
2561
  {
2529
2562
  return this.view.getUint8(ofst);
2530
2563
  }
2531
2564
 
2565
+ /**
2566
+ * @param {number} ofst
2567
+ * @param {boolean | undefined} lsb
2568
+ */
2532
2569
  readUInt16(ofst, lsb)
2533
2570
  {
2534
2571
  return this.view.getUint16(ofst, lsb);
2535
2572
  }
2536
2573
 
2574
+ /**
2575
+ * @param {number} ofst
2576
+ * @param {boolean | undefined} lsb
2577
+ */
2537
2578
  readUInt24(ofst, lsb)
2538
2579
  {
2539
2580
  if (lsb)
@@ -2542,21 +2583,45 @@ export class ByteReader
2542
2583
  return (this.view.getUint16(ofst, false) << 8) | this.view.getUint8(ofst + 2);
2543
2584
  }
2544
2585
 
2586
+ /**
2587
+ * @param {number} ofst
2588
+ * @param {boolean | undefined} lsb
2589
+ */
2545
2590
  readUInt32(ofst, lsb)
2546
2591
  {
2547
2592
  return this.view.getUint32(ofst, lsb);
2548
2593
  }
2549
2594
 
2595
+ /**
2596
+ * @param {number} ofst
2597
+ * @param {boolean | undefined} lsb
2598
+ */
2599
+ readUInt64(ofst, lsb)
2600
+ {
2601
+ return this.view.getBigUint64(ofst, lsb);
2602
+ }
2603
+
2604
+ /**
2605
+ * @param {number} ofst
2606
+ */
2550
2607
  readInt8(ofst)
2551
2608
  {
2552
2609
  return this.view.getInt8(ofst);
2553
2610
  }
2554
2611
 
2612
+ /**
2613
+ * @param {number} ofst
2614
+ * @param {boolean | undefined} lsb
2615
+ */
2555
2616
  readInt16(ofst, lsb)
2556
2617
  {
2557
2618
  return this.view.getInt16(ofst, lsb);
2558
2619
  }
2559
2620
 
2621
+ /**
2622
+ * @param {number} ofst
2623
+ * @param {boolean | undefined} lsb
2624
+ */
2560
2625
  readInt24(ofst, lsb)
2561
2626
  {
2562
2627
  if (lsb)
@@ -2565,11 +2630,24 @@ export class ByteReader
2565
2630
  return (this.view.getInt16(ofst, false) << 8) | this.view.getUint8(ofst + 2);
2566
2631
  }
2567
2632
 
2633
+ /**
2634
+ * @param {number} ofst
2635
+ * @param {boolean | undefined} lsb
2636
+ */
2568
2637
  readInt32(ofst, lsb)
2569
2638
  {
2570
2639
  return this.view.getInt32(ofst, lsb);
2571
2640
  }
2572
2641
 
2642
+ /**
2643
+ * @param {number} ofst
2644
+ * @param {boolean | undefined} lsb
2645
+ */
2646
+ readInt64(ofst, lsb)
2647
+ {
2648
+ return this.view.getBigInt64(ofst, lsb);
2649
+ }
2650
+
2573
2651
  readFloat64(ofst, lsb)
2574
2652
  {
2575
2653
  return this.view.getFloat64(ofst, lsb);
@@ -2710,9 +2788,21 @@ export class ByteReader
2710
2788
 
2711
2789
  export class ParsedObject
2712
2790
  {
2791
+ /**
2792
+ * @param {string} sourceName
2793
+ * @param {string} objType
2794
+ */
2713
2795
  constructor(sourceName, objType)
2714
2796
  {
2715
2797
  this.sourceName = sourceName;
2716
2798
  this.objType = objType;
2717
2799
  }
2800
+
2801
+ /**
2802
+ * @param {string} sourceName
2803
+ */
2804
+ setSourceName(sourceName)
2805
+ {
2806
+ this.sourceName = sourceName;
2807
+ }
2718
2808
  }