芝麻web文件管理V1.00
编辑当前文件:/home/digitalh/www/node_modules/tailwindcss/lib/lib/remap-bitfield.js
// @ts-check /** * We must remap all the old bits to new bits for each set variant * Only arbitrary variants are considered as those are the only * ones that need to be re-sorted at this time * * An iterated process that removes and sets individual bits simultaneously * will not work because we may have a new bit that is also a later old bit * This means that we would be removing a previously set bit which we don't * want to do * * For example (assume `bN` = `1<
remapBitfield }); function remapBitfield(num, mapping) { // Create masks for the old and new bits that are set let oldMask = 0n; let newMask = 0n; for (let [oldBit, newBit] of mapping){ if (num & oldBit) { oldMask = oldMask | oldBit; newMask = newMask | newBit; } } // Remove all old bits // Set all new bits return num & ~oldMask | newMask; }