Source/NFX/IOMiscUtils.cs
/// <summary>
/// Reads an integer encoded as big endian from buffer at the specified index
/// and increments the idx by the number of bytes read
/// </summary>
Reads an integer encoded as big endian from buffer at the specified index
and increments the idx by the number of bytes read
Reads an integer encoded as big endian from buffer at the specified index and increments the idx by the number of bytes read
public static UInt64 ReadBEUInt64(this byte[] buf, int idx = 0)
        {
            return ((ulong)buf[idx++] << 56) +
                   ((ulong)buf[idx++] << 48) +
                   ((ulong)buf[idx++] << 40) +
                   ((ulong)buf[idx++] << 32) +
                   ((ulong)buf[idx++] << 24) +
                   ((ulong)buf[idx++] << 16) +
                   ((ulong)buf[idx++] << 8 ) +
                   ((ulong)buf[idx++]      );
        }
public static UInt64 ReadBEUInt64 ( this byte [ ] buf , int idx = 0 ) { return ( ( ulong ) buf [ idx ++ ] << 56 ) + ( ( ulong ) buf [ idx ++ ] << 48 ) + ( ( ulong ) buf [ idx ++ ] << 40 ) + ( ( ulong ) buf [ idx ++ ] << 32 ) + ( ( ulong ) buf [ idx ++ ] << 24 ) + ( ( ulong ) buf [ idx ++ ] << 16 ) + ( ( ulong ) buf [ idx ++ ] << 8 ) + ( ( ulong ) buf [ idx ++ ] ) ; }
Reads an integer encoded as big endian from buffer at the specified index
and increments the idx by the number of bytes read
Reads an integer encoded as big endian from buffer at the specified index and increments the idx by the number of bytes read
byte[]
this
idx
int