UNPKG

unreal.js

Version:

A pak reader for games like VALORANT & Fortnite written in Node.JS

23 lines (22 loc) 699 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BitSetExt = void 0; const Const_1 = require("./Const"); class BitSetExt { static indexOfFirst(bitSet, value) { const size = this.size(bitSet); for (let i = 0; i < size; ++i) { if (bitSet.get(i) === Number(value)) { return i; } } return Const_1.INDEX_NONE; } static size(bitSet) { const data = bitSet.data; return data.length * BitSetExt.BITS_PER_WORD; } } exports.BitSetExt = BitSetExt; BitSetExt.ADDRESS_BITS_PER_WORD = 6; BitSetExt.BITS_PER_WORD = 1 << BitSetExt.ADDRESS_BITS_PER_WORD;