X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FFoldingSet.cpp;h=463511408759ccc8cb5829ecf19ce8103ce1028c;hb=9be4884731b20e540b13b47737f0b4acb7c66e86;hp=0367c7ce45e2491425c96365683b2d27f014f1b8;hpb=34bc6b6e787f27b5c9e05c82de4c1b4ac9b117bc;p=oota-llvm.git diff --git a/lib/Support/FoldingSet.cpp b/lib/Support/FoldingSet.cpp index 0367c7ce45e..46351140875 100644 --- a/lib/Support/FoldingSet.cpp +++ b/lib/Support/FoldingSet.cpp @@ -305,7 +305,7 @@ FoldingSetImpl::Node /// is not already in the map. InsertPos must be obtained from /// FindNodeOrInsertPos. void FoldingSetImpl::InsertNode(Node *N, void *InsertPos) { - assert(N->getNextInBucket() == 0); + assert(!N->getNextInBucket()); // Do we need to grow the hashtable? if (NumNodes+1 > NumBuckets*2) { GrowHashTable(); @@ -323,7 +323,7 @@ void FoldingSetImpl::InsertNode(Node *N, void *InsertPos) { // If this is the first insertion into this bucket, its next pointer will be // null. Pretend as if it pointed to itself, setting the low bit to indicate // that it is a pointer to the bucket. - if (Next == nullptr) + if (!Next) Next = reinterpret_cast(reinterpret_cast(Bucket)|1); // Set the node's next pointer, and make the bucket point to the node. @@ -337,7 +337,7 @@ bool FoldingSetImpl::RemoveNode(Node *N) { // Because each bucket is a circular list, we don't need to compute N's hash // to remove it. void *Ptr = N->getNextInBucket(); - if (Ptr == nullptr) return false; // Not in folding set. + if (!Ptr) return false; // Not in folding set. --NumNodes; N->SetNextInBucket(nullptr); @@ -390,7 +390,7 @@ FoldingSetImpl::Node *FoldingSetImpl::GetOrInsertNode(FoldingSetImpl::Node *N) { FoldingSetIteratorImpl::FoldingSetIteratorImpl(void **Bucket) { // Skip to the first non-null non-self-cycle bucket. while (*Bucket != reinterpret_cast(-1) && - (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr)) + (!*Bucket || !GetNextPtr(*Bucket))) ++Bucket; NodePtr = static_cast(*Bucket); @@ -410,7 +410,7 @@ void FoldingSetIteratorImpl::advance() { do { ++Bucket; } while (*Bucket != reinterpret_cast(-1) && - (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr)); + (!*Bucket || !GetNextPtr(*Bucket))); NodePtr = static_cast(*Bucket); } @@ -420,6 +420,5 @@ void FoldingSetIteratorImpl::advance() { // FoldingSetBucketIteratorImpl Implementation FoldingSetBucketIteratorImpl::FoldingSetBucketIteratorImpl(void **Bucket) { - Ptr = (*Bucket == nullptr || GetNextPtr(*Bucket) == nullptr) ? (void*) Bucket - : *Bucket; + Ptr = (!*Bucket || !GetNextPtr(*Bucket)) ? (void*) Bucket : *Bucket; }