llvm.org GIT mirror llvm / 2bbb703
several bitfixes to JumpToBit git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36616 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
1 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
9292
9393 /// JumpToBit - Reset the stream to the specified bit number.
9494 void JumpToBit(uint64_t BitNo) {
95 unsigned WordNo = BitNo/32;
95 unsigned ByteNo = (BitNo/8) & ~3;
9696 unsigned WordBitNo = BitNo & 31;
97 assert(WordNo < (unsigned)(LastChar-FirstChar) && "Invalid location");
97 assert(ByteNo < (unsigned)(LastChar-FirstChar) && "Invalid location");
9898
9999 // Move the cursor to the right word.
100 NextChar = FirstChar+WordNo;
100 NextChar = FirstChar+ByteNo;
101101 BitsInCurWord = 0;
102102
103103 // Skip over any bits that are already consumed.
104 if (WordBitNo) Read(WordBitNo);
104 if (WordBitNo) {
105 NextChar -= 4;
106 Read(WordBitNo);
107 }
105108 }
106109
107110 /// GetAbbrevIDWidth - Return the number of bits used to encode an abbrev #.