예제 #1
0
        public static ulong PeekUInt64(this IBitBuffer buffer, int bitCount)
        {
            Span <byte> tmp = stackalloc byte[sizeof(ulong)];

            buffer.PeekBits(tmp, bitCount, tmp.Length * 8);
            return(BinaryPrimitives.ReadUInt64LittleEndian(tmp));
        }
예제 #2
0
        /// <summary>
        /// Reads the specified number of bits into an <see cref="int"/> without advancing the read position.
        /// </summary>
        public static int PeekInt32(this IBitBuffer buffer, int bitCount)
        {
            Span <byte> tmp = stackalloc byte[sizeof(int)];

            buffer.PeekBits(tmp, bitCount, tmp.Length * 8);
            return(BinaryPrimitives.ReadInt32LittleEndian(tmp));
        }