您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
28 行
778 B
28 行
778 B
using System;
|
|
using Unity.Burst;
|
|
using Unity.Collections;
|
|
using Unity.Collections.LowLevel.Unsafe;
|
|
using Unity.Jobs;
|
|
|
|
namespace Unity.Entities
|
|
{
|
|
internal unsafe struct EntityInChunk : IComparable<EntityInChunk>, IEquatable<EntityInChunk>
|
|
{
|
|
public Chunk* Chunk;
|
|
public int IndexInChunk;
|
|
|
|
public int CompareTo(EntityInChunk other)
|
|
{
|
|
ulong lhs = (ulong) Chunk;
|
|
ulong rhs = (ulong) other.Chunk;
|
|
int chunkCompare = (int)(lhs - rhs);
|
|
int indexCompare = IndexInChunk - other.IndexInChunk;
|
|
return (lhs != rhs) ? chunkCompare : indexCompare;
|
|
}
|
|
|
|
public bool Equals(EntityInChunk other)
|
|
{
|
|
return CompareTo(other) == 0;
|
|
}
|
|
}
|
|
}
|