1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- namespace SharpCompress.Compressors.Rar.VM
- {
- internal class BitInput
- {
-
- internal const int MAX_SIZE = 0x8000;
- public int inAddr;
- public int inBit;
- public int InAddr { get { return inAddr; } set { inAddr = value; } }
- public int InBit { get { return inBit; } set { inBit = value; } }
- public bool ExternalBuffer;
-
- internal BitInput()
- {
- InBuf = new byte[MAX_SIZE];
- }
- internal byte[] InBuf { get; }
- internal void InitBitInput()
- {
- inAddr = 0;
- inBit = 0;
- }
- internal void faddbits(uint bits) {
-
- AddBits((int)bits);
- }
-
-
-
-
- internal void AddBits(int bits)
- {
- bits += inBit;
- inAddr += (bits >> 3);
- inBit = bits & 7;
- }
- internal uint fgetbits() {
-
- return (uint)GetBits();
- }
- internal uint getbits() {
-
- return (uint)GetBits();
- }
-
-
-
-
-
-
- internal int GetBits()
- {
-
-
-
-
-
-
- return ((Utility.URShift((((InBuf[inAddr] & 0xff) << 16)
- + ((InBuf[inAddr + 1] & 0xff) << 8)
- + ((InBuf[inAddr + 2] & 0xff))), (8 - inBit))) & 0xffff);
- }
-
-
-
-
-
- internal bool Overflow(int IncPtr)
- {
- return (inAddr + IncPtr >= MAX_SIZE);
- }
- }
- }
|