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 | 2bbb703e4f84c68a9603838c32eba7423ed54b71 (patch) | |
tree | 91664782f02c17cd42a882f18e3aac2accd6f9a5 /include/llvm/Bitcode | |
parent | 866971474ced63f725bd3dbf10fdb9e3badb7d9e (diff) | |
download | external_llvm-2bbb703e4f84c68a9603838c32eba7423ed54b71.zip external_llvm-2bbb703e4f84c68a9603838c32eba7423ed54b71.tar.gz external_llvm-2bbb703e4f84c68a9603838c32eba7423ed54b71.tar.bz2 |
several bitfixes to JumpToBit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Bitcode')
-rw-r--r-- | include/llvm/Bitcode/BitstreamReader.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h index 634bc73..8d70f1f 100644 --- a/include/llvm/Bitcode/BitstreamReader.h +++ b/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 #. |