(index: number, generation: number)
| 71 | * @returns 实体句柄 | Entity handle |
| 72 | */ |
| 73 | export function makeHandle(index: number, generation: number): EntityHandle { |
| 74 | // handle = generation * 2^28 + index |
| 75 | // 使用乘法而不是位移,因为位移只支持 32 位 |
| 76 | return ((generation & GEN_MASK) * MAX_ENTITIES + (index & INDEX_MASK)) as EntityHandle; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * 从句柄提取索引 |
no outgoing calls
no test coverage detected