diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-01 05:51:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-01 05:51:32 +0000 |
commit | 81c7fc2783b67d580d8dc2d254e7041f702cd66b (patch) | |
tree | 1946c60a9f2593050e417c8257cc9e11d949f75a /llvm | |
parent | 48a8de3f4d8cb8e0abffde27d3b3933d593e78c2 (diff) | |
download | bcm5719-llvm-81c7fc2783b67d580d8dc2d254e7041f702cd66b.tar.gz bcm5719-llvm-81c7fc2783b67d580d8dc2d254e7041f702cd66b.zip |
several bitfixes to JumpToBit
llvm-svn: 36616
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/Bitcode/BitstreamReader.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/include/llvm/Bitcode/BitstreamReader.h b/llvm/include/llvm/Bitcode/BitstreamReader.h index 634bc738dfd..8d70f1f7133 100644 --- a/llvm/include/llvm/Bitcode/BitstreamReader.h +++ b/llvm/include/llvm/Bitcode/BitstreamReader.h @@ -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 #. |