using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SDL2Demo { internal static class ByteArrayExtensions { private static byte[] buffer = new byte[4]; [DebuggerStepThrough] public static uint ReadUInt32BE(this byte[] stream, int offset) { buffer[0] = stream[offset + 0]; buffer[1] = stream[offset + 1]; buffer[2] = stream[offset + 2]; buffer[3] = stream[offset + 3]; if (BitConverter.IsLittleEndian) Array.Reverse(buffer, 0, 4); return BitConverter.ToUInt32(buffer, 0); } } }