From 6123f267653abd9c5eebab60963440f2e79a4fad Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Fri, 5 Jul 2024 22:05:21 +0800 Subject: [PATCH] update --- src/Executors/EcsJoinToSubGraphExecutor.cs | 8 ++++---- src/Internal/SparseMatrix.cs | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Executors/EcsJoinToSubGraphExecutor.cs b/src/Executors/EcsJoinToSubGraphExecutor.cs index f89d93d..3cc8068 100644 --- a/src/Executors/EcsJoinToSubGraphExecutor.cs +++ b/src/Executors/EcsJoinToSubGraphExecutor.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; namespace DCFApixels.DragonECS { public sealed class EcsJoinToSubGraphExecutor : EcsJoinToSubGraphExecutor - where TAspect : EcsAspect + where TAspect : EcsAspect, new() { private TAspect _aspect; @@ -362,18 +362,18 @@ namespace DCFApixels.DragonECS #region JoinToGraph public static EcsSubGraph JoinToSubGraph(this TCollection entities, out TAspect aspect, EcsSubGraphMode mode = EcsSubGraphMode.StartToEnd) - where TAspect : EcsAspect + where TAspect : EcsAspect, new() where TCollection : IEntityStorage { return entities.ToSpan().JoinToSubGraph(out aspect, mode); } public static EcsSubGraph JoinToSubGraph(this EcsReadonlyGroup group, out TAspect aspect, EcsSubGraphMode mode = EcsSubGraphMode.StartToEnd) - where TAspect : EcsAspect + where TAspect : EcsAspect, new() { return group.ToSpan().JoinToSubGraph(out aspect, mode); } public static EcsSubGraph JoinToSubGraph(this EcsSpan span, out TAspect aspect, EcsSubGraphMode mode = EcsSubGraphMode.StartToEnd) - where TAspect : EcsAspect + where TAspect : EcsAspect, new() { EcsWorld world = span.World; if (world.IsEnableReleaseDelEntBuffer) diff --git a/src/Internal/SparseMatrix.cs b/src/Internal/SparseMatrix.cs index 9826dc6..60ed27f 100644 --- a/src/Internal/SparseMatrix.cs +++ b/src/Internal/SparseMatrix.cs @@ -346,15 +346,19 @@ namespace DCFApixels.DragonECS.Graphs.Internal x ^= x >> 17; return x; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static bool EqualsInFind(Key a, Key b) { return a.x == b.x; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(Key a, Key b) { return a.x == b.x && a.yHash == b.yHash; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(Key a, Key b) { return a.x != b.x || a.yHash != b.yHash; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public override int GetHashCode() { return yHash; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(Key other) { return this == other; } public override bool Equals(object obj) { return obj is Key && Equals((Key)obj); } - public override string ToString() - { - return $"({x}, {yHash})"; - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public override string ToString() { return $"({x}, {yHash})"; } } #endregion }