aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-29 19:49:58 +0000
committerChris Lattner <sabre@nondot.org>2007-04-29 19:49:58 +0000
commita2d0ad4fe26df1e32610ccd99d084a98daeb5c67 (patch)
tree9992d515cbb9265f37121d72007cf19e6af58ed7 /include
parent8593e418555fdae21a070357fd8734b4069c17d0 (diff)
compute this value correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Bitcode/BitstreamReader.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h
index f41c4f0ec3..c6394b6c99 100644
--- a/include/llvm/Bitcode/BitstreamReader.h
+++ b/include/llvm/Bitcode/BitstreamReader.h
@@ -48,9 +48,11 @@ class BitstreamReader {
/// BlockScope - This tracks the codesize of parent blocks.
SmallVector<Block, 8> BlockScope;
+ /// FirstChar - This remembers the first byte of the stream.
+ const unsigned char *FirstChar;
public:
BitstreamReader(const unsigned char *Start, const unsigned char *End)
- : NextChar(Start), LastChar(End) {
+ : NextChar(Start), LastChar(End), FirstChar(Start) {
assert(((End-Start) & 3) == 0 &&"Bitcode stream not a multiple of 4 bytes");
CurWord = 0;
BitsInCurWord = 0;
@@ -74,7 +76,7 @@ public:
/// GetCurrentBitNo - Return the bit # of the bit we are reading.
uint64_t GetCurrentBitNo() const {
- return CurWord * 32ULL + (32-CurCodeSize);
+ return (NextChar-FirstChar)*8 + (32-BitsInCurWord);
}