-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Labels
arch-wasmWebAssembly architectureWebAssembly architecturearea-System.Runtime.InteropServices.JavaScriptin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedos-browserBrowser variant of arch-wasmBrowser variant of arch-wasm
Milestone
Description
Lines 49 to 58 in 790b14b
| // there could be multiple method signatures with the same name, get unique signature name | |
| uint hash = 17; | |
| unchecked | |
| { | |
| foreach (var param in sigContext.ElementTypeInformation) | |
| { | |
| hash = hash * 31 + (uint)param.ManagedType.FullTypeName.GetHashCode(); | |
| } | |
| }; | |
| int typesHash = Math.Abs((int)hash); |
The last line does not seem correct. If (int)hash == int.MinValue, Math.Abs would throw, which I suppose is not the intended behaviour for a hash function. I would suggest simply int typesHash = (int)hash & int.MaxValue;, or if the hash code is required to be persistent across versions, int typesHash = (int)hash == int.MinValue ? int.MaxValue : Math.Abs((int)hash).
EgorBo
Metadata
Metadata
Assignees
Labels
arch-wasmWebAssembly architectureWebAssembly architecturearea-System.Runtime.InteropServices.JavaScriptin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedos-browserBrowser variant of arch-wasmBrowser variant of arch-wasm