PerformanceStubs
PerformanceStubs copied to clipboard
Make `unsafe` handle big endian
[via comment from Stack Overflow question]
The unsafe
byte->string variant to handle when BitConverter.IsLittleEndian == false
.
Comment indicates that the original CodesInChaos source material handles this situation, which appears true.
if(BitConverter.IsLittleEndian)
result[i] = ((uint)s[0]) + ((uint)s[1] << 16);
else
result[i] = ((uint)s[1]) + ((uint)s[0] << 16);