mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 17:02:10 -10:00
http://www.bytefx.com/releases/ByteFX.MySqlClient.76.src.zip svn path=/trunk/mcs/; revision=27556
54 lines
957 B
C#
Executable File
54 lines
957 B
C#
Executable File
using System;
|
|
using System.IO;
|
|
|
|
namespace ByteFX.Data.Common
|
|
{
|
|
/// <summary>
|
|
/// Summary description for BitStream.
|
|
/// </summary>
|
|
public class BitStream : MemoryStream
|
|
{
|
|
private byte[] _input;
|
|
private int _start;
|
|
private int _end;
|
|
private int _bitindex;
|
|
private uint _bitbuffer;
|
|
private int _bits_in_buffer;
|
|
|
|
public BitStream(byte[] input, int index, int len)
|
|
{
|
|
_bitindex = 0;
|
|
_bitbuffer = 0;
|
|
_bits_in_buffer = 0;
|
|
_input = input;
|
|
_start = index;
|
|
_end = _start + len;
|
|
}
|
|
|
|
public int GetBits(int numbits)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
public int PeekBits(int numbits)
|
|
{
|
|
int val=0;
|
|
|
|
int index=_start;
|
|
while (numbits > 0)
|
|
{
|
|
val = (val << 8) | _input[index++];
|
|
numbits -= 8;
|
|
}
|
|
|
|
while (_bits_in_buffer < numbits)
|
|
{
|
|
if (_start == _end)
|
|
throw new Exception("Out of bits");
|
|
byte b = _input[_start++];
|
|
}
|
|
return 0;
|
|
}
|
|
}
|
|
}
|