@rhyster/wow-casc-dbc 2.12.11 → 2.13.1

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/dist/index.mjs CHANGED
@@ -1071,18 +1071,13 @@ const readBitpackedValue = (buffer, fieldOffsetBits, fieldSizeBits, signed = fal
1071
1071
  const offsetBytes = fieldOffsetBits >>> 3;
1072
1072
  const bitOffset = fieldOffsetBits & 7;
1073
1073
  const sizeBytes = Math.ceil((fieldSizeBits + bitOffset) / 8);
1074
- if (sizeBytes <= 6) {
1075
- const rawValue = buffer.readUIntLE(offsetBytes, sizeBytes);
1076
- return Number(
1077
- signed ? BigInt.asIntN(fieldSizeBits, BigInt(rawValue >>> bitOffset)) : BigInt.asUintN(fieldSizeBits, BigInt(rawValue >>> bitOffset))
1078
- );
1079
- }
1080
1074
  let value = 0n;
1081
1075
  for (let i = sizeBytes - 1; i >= 0; i -= 1) {
1082
1076
  const byte = buffer.readUInt8(offsetBytes + i);
1083
1077
  value = value << 8n | BigInt(byte);
1084
1078
  }
1085
- return signed ? BigInt.asIntN(fieldSizeBits, value >> BigInt(bitOffset)) : BigInt.asUintN(fieldSizeBits, value >> BigInt(bitOffset));
1079
+ const result = signed ? BigInt.asIntN(fieldSizeBits, value >> BigInt(bitOffset)) : BigInt.asUintN(fieldSizeBits, value >> BigInt(bitOffset));
1080
+ return fieldSizeBits <= 32 ? Number(result) : result;
1086
1081
  };
1087
1082
  const isDataRangeAllZero = (buffer, offset, length) => {
1088
1083
  const end = offset + length;