< Summary

Information
Class: Lattice.ECS.Core.HashCodeUtils
Assembly: Lattice
File(s): /home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Core/HashCodeUtils.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 36
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
UInt64HashCode(...)100%210%
CombineHashCodes(...)100%210%

File(s)

/home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Core/HashCodeUtils.cs

#LineLine coverage
 1// Copyright (c) 2026 Sideline Authors. All rights reserved.
 2// Licensed under GPL-3.0.
 3
 4using System.Runtime.CompilerServices;
 5
 6namespace Lattice.ECS.Core
 7{
 8    /// <summary>
 9    /// 哈希码工具类,对齐 FrameSync HashCodeUtils
 10    /// </summary>
 11    public static class HashCodeUtils
 12    {
 13        /// <summary>
 14        /// 计算 ulong 的哈希码
 15        /// </summary>
 16        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 17        public static int UInt64HashCode(ulong value)
 18        {
 19            // 使用与 FrameSync 相同的算法
 020            return value.GetHashCode();
 21        }
 22
 23        /// <summary>
 24        /// 组合两个哈希码
 25        /// </summary>
 26        [MethodImpl(MethodImplOptions.AggressiveInlining)]
 27        public static int CombineHashCodes(int h1, int h2)
 28        {
 29            // 使用与 .NET 相同的算法
 30            unchecked
 31            {
 032                return ((h1 << 5) + h1) ^ h2;
 33            }
 34        }
 35    }
 36}