public static void WriteInt(this Stream s, long num, BitUtils.Bitness bits, EndianUtils.Endianness endian)
        {
            switch (bits)
            {
            case BitUtils.Bitness.B8: s.WriteInt8((sbyte)num); return;

            case BitUtils.Bitness.B16: s.WriteInt16((short)num, endian); return;

            case BitUtils.Bitness.B32: s.WriteInt32((int)num, endian); return;

            case BitUtils.Bitness.B64: s.WriteInt64(num, endian); return;
            }
            throw new Exception("Writing int not implemented for bitness " + bits.ToString());
        }
        public static long PeekInt(this Stream s, BitUtils.Bitness bits, EndianUtils.Endianness endian)
        {
            switch (bits)
            {
            case BitUtils.Bitness.B8: return(s.PeekInt8());

            case BitUtils.Bitness.B16: return(s.PeekInt16(endian));

            case BitUtils.Bitness.B32: return(s.PeekInt32(endian));

            case BitUtils.Bitness.B64: return(s.PeekInt64(endian));
            }
            throw new Exception("Peeking int not implemented for bitness " + bits.ToString());
        }