mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 01:44:35 +08:00
usafe optimise GetEntityLong
This commit is contained in:
parent
649037577d
commit
43c5adc6cc
@ -201,7 +201,11 @@ namespace DCFApixels.DragonECS
|
||||
ReleaseDelEntityBuffer();
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public entlong GetEntityLong(int entityID) => new entlong(entityID, _gens[entityID], id); //TODO придумать получше имя метода
|
||||
public unsafe entlong GetEntityLong(int entityID)
|
||||
{
|
||||
long x = ((long)id << 48 | (long)_gens[entityID] << 32 | entityID);
|
||||
return *(entlong*)&x;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool IsAlive(int entityID, short gen) => _gens[entityID] == gen;
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
Loading…
Reference in New Issue
Block a user