proc byte():uint8 = #Code omitted, reads a byte from a bitstream #reads a word from the bitstream proc word():uint32 = return (byte() shl 24) or (byte() shl 16) or (byte() shl 8) or byte() #reads a dynamically sized number from the bitstream proc dynamic():int= var b = byte() return case b and 0xC0 of 0x00: int(b) of 0x40: int(b or (not uint8(0x7F))) of 0x80: if (uint8(b) and uint8(0x20)) > uint8(0): b = uint8(b) or (not uint8(0x3F)) else: b = uint8(b) and uint8(0x3F) int((b shl 8) or byte()) of 0xC0: echo "b",(uint8(b) and uint8(0x20)) if(uint8(b) and uint8(0x20))> uint8(0): int(b or (not uint8(0x3F))) else: (int(b and uint8(0x3F)) shl 24) or (int(byte()) shl 16) or (int(byte()) shl 8) or int(byte()) else: 0 # Invalid bitstream not sure how to handle this