From 6786dd090dfb734a4f74bc8411b1706994e8c913 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 21 Dec 2024 18:58:48 +1100 Subject: [PATCH] remove redundant null check in ComputeStringHash --- .../Helpers/FNV1HashHelper.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Helpers/FNV1HashHelper.cs b/src/Platform/Microsoft.Testing.Extensions.HangDump/Helpers/FNV1HashHelper.cs index 26d5b0ea80..9fc662c1b1 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Helpers/FNV1HashHelper.cs +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Helpers/FNV1HashHelper.cs @@ -14,16 +14,12 @@ internal static class FNV_1aHashHelper /// public static uint ComputeStringHash(string s) { - uint num = default; - if (s != null) + uint num = 2166136261u; + int num2 = 0; + while (num2 < s.Length) { - num = 2166136261u; - int num2 = 0; - while (num2 < s.Length) - { - num = (s[num2] ^ num) * 16777619; - num2++; - } + num = (s[num2] ^ num) * 16777619; + num2++; } return num;