C# Class System.Xml.BitStack

Manages a stack of bits. Exposes push, pop, and peek operations.
显示文件 Open project: gbarnett/shared-source-cli-2.0 Class Usage Examples

Public Methods

Method Description
BitStack ( ) : System

Initialize stack.

PeekBit ( ) : bool

Return the top bit on the stack without pushing or popping.

PopBit ( ) : bool

Pop the top bit from the stack and return it.

PushBit ( bool bit ) : void

Push a 0 or 1 bit onto the stack.

Private Methods

Method Description
PopCurr ( ) : void

If all bits have been popped from this.curr, then pop the previous uint value from the stack in order to provide another 31 bits.

PushCurr ( ) : void

this.curr has enough space for 31 bits (minus 1 for sentinel bit). Once this space is exhausted, a uint stack is created to handle the overflow.

Method Details

BitStack() public method

Initialize stack.
public BitStack ( ) : System
return System

PeekBit() public method

Return the top bit on the stack without pushing or popping.
public PeekBit ( ) : bool
return bool

PopBit() public method

Pop the top bit from the stack and return it.
public PopBit ( ) : bool
return bool

PushBit() public method

Push a 0 or 1 bit onto the stack.
public PushBit ( bool bit ) : void
bit bool
return void