Improve BitConverter.ToIntNN methods (dotnet/coreclr#9803)
* Improve BitConverter.ToIntNN methods
- Avoid duplicate argument validation
- Fix failed optimization attempt: (uint)i < a.Length needs to be (uint) < (uint)a.Length otherwise it gets promoted to long and that's bad for 32 bit architectures
- Workaround JIT limitation: fixed variables cannot be enregistered
- Use Unsafe.ReadUnaligned to avoid alignment handling complications
- Use Unsafe.As instead of fixed as it generates shorter code
- Don't forward unsigned method to signed methods. The JIT doesn't want to inline the signed methods even though the generated code isn't significantly larger
Commit migrated from https://github.com/dotnet/coreclr/commit/
ac1dcaef3e9ddb5290b555db2aefca2adfe52419