1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

several bitfixes to JumpToBit

llvm-svn: 36616
This commit is contained in:
Chris Lattner 2007-05-01 05:51:32 +00:00
parent 7544cfb05c
commit 21e0d64a6e

View File

@ -93,16 +93,19 @@ public:
/// JumpToBit - Reset the stream to the specified bit number.
void JumpToBit(uint64_t BitNo) {
unsigned WordNo = BitNo/32;
unsigned ByteNo = (BitNo/8) & ~3;
unsigned WordBitNo = BitNo & 31;
assert(WordNo < (unsigned)(LastChar-FirstChar) && "Invalid location");
assert(ByteNo < (unsigned)(LastChar-FirstChar) && "Invalid location");
// Move the cursor to the right word.
NextChar = FirstChar+WordNo;
NextChar = FirstChar+ByteNo;
BitsInCurWord = 0;
// Skip over any bits that are already consumed.
if (WordBitNo) Read(WordBitNo);
if (WordBitNo) {
NextChar -= 4;
Read(WordBitNo);
}
}
/// GetAbbrevIDWidth - Return the number of bits used to encode an abbrev #.