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

Alkis Evlogimenos alkis at cs.uiuc.edu
Mon Nov 8 00:00:50 PST 2004



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

Bytecode.h updated: 1.12 -> 1.13
---
Log message:

Fix pad skipping. Make short and int reads not depends on the order of
evaluation of |.


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

Index: llvm-java/include/llvm/Java/Bytecode.h
diff -u llvm-java/include/llvm/Java/Bytecode.h:1.12 llvm-java/include/llvm/Java/Bytecode.h:1.13
--- llvm-java/include/llvm/Java/Bytecode.h:1.12	Mon Oct 11 16:51:24 2004
+++ llvm-java/include/llvm/Java/Bytecode.h	Mon Nov  8 02:00:40 2004
@@ -14,9 +14,6 @@
 #ifndef LLVM_JAVA_BYTECODE_H
 #define LLVM_JAVA_BYTECODE_H
 
-#include <iosfwd>
-#include <vector>
-
 #include <stdint.h>
 
 namespace llvm { namespace Java {
@@ -249,15 +246,18 @@
   }
 
   inline int readSShort(const uint8_t* code, unsigned& i) {
-    return (readSByte(code, i) << 8) | readUByte(code, i);
+    int val = readSByte(code, i) << 8;
+    return val | readUByte(code, i);
   }
 
   inline unsigned readUShort(const uint8_t* code, unsigned& i) {
-    return (readUByte(code, i) << 8) | readUByte(code, i);
+    unsigned val = readUByte(code, i) << 8;
+    return val | readUByte(code, i);
   }
 
   inline int readSInt(const uint8_t* code, unsigned& i) {
-    return (readUShort(code, i) << 16) | readUShort(code, i);
+    int val = readUShort(code, i) << 16;
+    return val | readUShort(code, i);
   }
 
   inline unsigned readUInt(const uint8_t* code, unsigned& i) {
@@ -265,6 +265,7 @@
   }
 
   inline void skipPadBytes(unsigned& i) {
+    ++i;
     unsigned lastTwoBits = i & 0x3;
     i += (4 - lastTwoBits) & 0x3;
     --i;






More information about the llvm-commits mailing list