[interp] Use correctly-sized writes and reads in Unsafe.AddByteOffset and Unsafe.ByteOffset (mono/mono#15677)
[interp] Use correctly-sized writes and reads in Unsafe.AddByteOffset and Unsafe.ByteOffset
The truncated store to the top of the stack in`MINT_INTRINS_UNSAFE_BYTE_OFFSET` could cause the upper bytes of the address used as the first argument to `ByteOffset` to linger, yielding inaccurate (and usually excessively large) offsets on systems where `sizeof(void *) > sizeof(guint32)`; this made
`System.Text.Unicode.Utf8Utility.GetPointerToFirstInvalidByte` return nonsense results.
The truncation in `MINT_INTRINS_UNSAFE_ADD_BYTE_OFFSET` hasn't, as far as I know, caused any test failures. But `AddByteOffset` takes an `IntPtr` as its second argument, not an `int`.
Fixes mono/mono#14847.
Commit migrated from https://github.com/mono/mono/commit/
561b400baa6322dcb3fb6d2b92bd48513fab79f7