Add support for casting any pointer to any integer type
authorChris Lattner <sabre@nondot.org>
Mon, 18 Aug 2003 17:23:40 +0000 (17:23 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 18 Aug 2003 17:23:40 +0000 (17:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7953 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/ExecutionEngine.cpp

index 9b119c73e3547a2d1298c4eae0e3a25602212e90..e37d56f2cca0b5334070ba090fad778c8166f1ce 100644 (file)
@@ -54,13 +54,15 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
       if (Op->getType()->getPrimitiveID() == C->getType()->getPrimitiveID())
         return getConstantValue(Op);
 
-      // Handle cast of long to pointer or pointer to long...
-      if ((isa<PointerType>(Op->getType()) && (C->getType() == Type::LongTy ||
-                                               C->getType() == Type::ULongTy))||
-          (isa<PointerType>(C->getType()) && (Op->getType() == Type::LongTy ||
-                                              Op->getType() == Type::ULongTy))){
+      // Handle a cast of pointer to any integral type...
+      if (isa<PointerType>(Op->getType()) &&
+          (C->getType() == Type::LongTy || C->getType() == Type::ULongTy))
+        return getConstantValue(Op);
+        
+      // Handle cast of long to pointer...
+      if (isa<PointerType>(C->getType()) && (Op->getType() == Type::LongTy ||
+                                             Op->getType() == Type::ULongTy))
         return getConstantValue(Op);
-      }
       break;
     }