[llvm-commits] CVS: llvm/include/llvm/Bitcode/BitstreamReader.h

Chris Lattner sabre at nondot.org
Mon Apr 30 22:51:51 PDT 2007



Changes in directory llvm/include/llvm/Bitcode:

BitstreamReader.h updated: 1.10 -> 1.11
---
Log message:

several bitfixes to JumpToBit


---
Diffs of the changes:  (+7 -4)

 BitstreamReader.h |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/Bitcode/BitstreamReader.h
diff -u llvm/include/llvm/Bitcode/BitstreamReader.h:1.10 llvm/include/llvm/Bitcode/BitstreamReader.h:1.11
--- llvm/include/llvm/Bitcode/BitstreamReader.h:1.10	Mon Apr 30 23:59:06 2007
+++ llvm/include/llvm/Bitcode/BitstreamReader.h	Tue May  1 00:51:32 2007
@@ -93,16 +93,19 @@
   
   /// 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 #.






More information about the llvm-commits mailing list