Simplify & microoptimize code. No intended functionality change.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 18 Jul 2011 00:00:20 +0000 (00:00 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 18 Jul 2011 00:00:20 +0000 (00:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135364 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/FoldingSet.cpp

index 1568342e9c9d1eab31534ed216aab788d19f0e45..17b827132f577077f20cd4ef0e7bab790d9dd940 100644 (file)
@@ -64,10 +64,8 @@ void FoldingSetNodeID::AddPointer(const void *Ptr) {
   // 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);