[llvm-commits] CVS: llvm-java/include/llvm/Java/Bytecode.h

Alkis Evlogimenos alkis at cs.uiuc.edu
Mon May 24 22:49:02 PDT 2004


Changes in directory llvm-java/include/llvm/Java:

Bytecode.h updated: 1.7 -> 1.8

---
Log message:

Simplify code for readSInt() and fix bug in skipPadBytes().


---
Diffs of the changes:  (+5 -6)

Index: llvm-java/include/llvm/Java/Bytecode.h
diff -u llvm-java/include/llvm/Java/Bytecode.h:1.7 llvm-java/include/llvm/Java/Bytecode.h:1.8
--- llvm-java/include/llvm/Java/Bytecode.h:1.7	Mon May 24 20:48:00 2004
+++ llvm-java/include/llvm/Java/Bytecode.h	Mon May 24 22:46:15 2004
@@ -250,18 +250,17 @@
     }
 
     inline int readSInt(const uint8_t* code, unsigned& i) {
-        return ((readUByte(code, i) << 24) |
-                (readUByte(code, i) << 16) |
-                (readUByte(code, i) << 8) |
-                readUByte(code, i));
+        return (readUShort(code, i) << 16) | readUShort(code, i);
     }
 
     inline unsigned readUInt(const uint8_t* code, unsigned& i) {
         return readSInt(code, i);
     }
 
-    inline void skipPadBytes(const uint8_t* code, unsigned& i) {
-        while (((unsigned)&code[++i]) & 0XFF);
+    inline void skipPadBytes(unsigned& i) {
+        unsigned lastTwoBits = i & 0x3;
+        i += (4 - lastTwoBits) & 0x3;
+        --i;
     }
 
 } } // namespace llvm::Java





More information about the llvm-commits mailing list