diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-09-11 15:11:09 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-09-11 15:11:09 -0500 |
| commit | cdef8238bd5925caf855023db4b00dc449307aa2 (patch) | |
| tree | 80ff4bb70be6fbe7d3a4ab64e665c14894d935e5 /src/slskd/Common/Extensions.cs | |
| parent | a363f956c9e8e923c647877832f3c3bb9f5c4351 (diff) | |
| download | slskd-cdef8238bd5925caf855023db4b00dc449307aa2.tar.gz | |
clean up warnings
Diffstat (limited to 'src/slskd/Common/Extensions.cs')
| -rw-r--r-- | src/slskd/Common/Extensions.cs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/slskd/Common/Extensions.cs b/src/slskd/Common/Extensions.cs index 077f5b17..4f2cf29f 100644 --- a/src/slskd/Common/Extensions.cs +++ b/src/slskd/Common/Extensions.cs @@ -89,36 +89,6 @@ namespace slskd } /// <summary> - /// Computes a stable/consistent hash code for strings. - /// </summary> - /// <remarks> - /// https://stackoverflow.com/questions/5154970/how-do-i-create-a-hashcode-in-net-c-for-a-string-that-is-safe-to-store-in-a - /// </remarks> - /// <param name="str">The string for which the hash code is to be computed.</param> - /// <returns>The hash code.</returns> - public static int GetStableHashCode(this string str) - { - unchecked - { - int hash1 = 5381; - int hash2 = hash1; - - for (int i = 0; i < str.Length && str[i] != '\0'; i += 2) - { - hash1 = ((hash1 << 5) + hash1) ^ str[i]; - if (i == str.Length - 1 || str[i + 1] == '\0') - { - break; - } - - hash2 = ((hash2 << 5) + hash2) ^ str[i + 1]; - } - - return hash1 + (hash2 * 1566083941); - } - } - - /// <summary> /// Determines whether the string is a valid regular expression. /// </summary> /// <param name="pattern">The string to validate.</param> |
