[llvm-commits] [llvm] r135364 - /llvm/trunk/lib/Support/FoldingSet.cpp

Benjamin Kramer benny.kra at googlemail.com
Sun Jul 17 17:00:20 PDT 2011


Author: d0k
Date: Sun Jul 17 19:00:20 2011
New Revision: 135364

URL: http://llvm.org/viewvc/llvm-project?rev=135364&view=rev
Log:
Simplify & microoptimize code. No intended functionality change.

Modified:
    llvm/trunk/lib/Support/FoldingSet.cpp

Modified: llvm/trunk/lib/Support/FoldingSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=135364&r1=135363&r2=135364&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FoldingSet.cpp (original)
+++ llvm/trunk/lib/Support/FoldingSet.cpp Sun Jul 17 19:00:20 2011
@@ -64,10 +64,8 @@
   // depend on the host.  It doesn't matter however, because hashing on
   // pointer values in inherently unstable.  Nothing  should depend on the 
   // ordering of nodes in the folding set.
-  intptr_t PtrI = (intptr_t)Ptr;
-  Bits.push_back(unsigned(PtrI));
-  if (sizeof(intptr_t) > sizeof(unsigned))
-    Bits.push_back(unsigned(uint64_t(PtrI) >> 32));
+  Bits.append(reinterpret_cast<unsigned *>(&Ptr),
+              reinterpret_cast<unsigned *>(&Ptr+1));
 }
 void FoldingSetNodeID::AddInteger(signed I) {
   Bits.push_back(I);





More information about the llvm-commits mailing list