MCPcopy Create free account
hub / github.com/esengine/esengine / getLowestBitIndex

Method getLowestBitIndex

packages/core/src/ECS/Utils/Bits.ts:342–360  ·  view source on GitHub ↗

* 获取最低位设置位的索引 * @returns 最低位设置位的索引,如果位集合为空则返回-1

()

Source from the content-addressed store, hash-verified

340 * @returns 最低位设置位的索引,如果位集合为空则返回-1
341 */
342 public getLowestBitIndex(): number {
343 if (BitMask64Utils.isZero(this._value)) {
344 return -1;
345 }
346
347 for (let i = 0; i < 32; i++) {
348 if ((this._value.base[SegmentPart.LOW] & (1 << i)) !== 0) {
349 return i;
350 }
351 }
352
353 for (let i = 0; i < 32; i++) {
354 if ((this._value.base[SegmentPart.HIGH] & (1 << i)) !== 0) {
355 return i + 32;
356 }
357 }
358
359 return -1;
360 }
361}

Callers 1

Bits.test.tsFile · 0.45

Calls 1

isZeroMethod · 0.45

Tested by

no test coverage detected