1032 {
1033 try
1034 {
1035 byte* ptr2 = (byte*)(void*)ptr + ofs;
1036 if (((int)ptr2 & 1) == 0)
1037 {
1038 *(short*)ptr2 = val;
1039 }
1040 else
1041 {
1042 Unsafe.WriteUnaligned(ptr2, val);
1043 }
1044 }
1045 catch (NullReferenceException)
1046 {
1047 throw new AccessViolationException();
1048 }
1049 }