* 根据位索引创建64位掩码 * @param bitIndex 位索引,范围 [0, 63] * @returns 包含指定位设置为1的掩码 * @throws 当位索引超出范围时抛出错误
(bitIndex: number)
| 34 | * @throws 当位索引超出范围时抛出错误 |
| 35 | */ |
| 36 | public static create(bitIndex: number): BitMask64Data { |
| 37 | if (bitIndex < 0) { |
| 38 | throw new Error(`Bit index ${bitIndex} out of range [0, ∞)`); |
| 39 | } |
| 40 | const mask: BitMask64Data = { base: [0, 0] }; |
| 41 | BitMask64Utils.setBit(mask, bitIndex); |
| 42 | return mask; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * 从32位数字创建64位掩码 |
no test coverage detected