Swap a few APIs to reduce sign and implicit truncations required to work with it
[folly.git] / folly / AtomicUnorderedMap.h
index 12c02579d6b2f81fd25bbdaaa6150620b5fbaca0..45877e1ce475a59b5392cc92b4e40aeaf6194f26 100644 (file)
@@ -338,8 +338,7 @@ struct AtomicUnorderedInsertMap {
   }
 
  private:
-
-  enum {
+  enum : IndexType {
     kMaxAllocationTries = 1000, // after this we throw
   };
 
@@ -437,7 +436,7 @@ struct AtomicUnorderedInsertMap {
   /// Allocates a slot and returns its index.  Tries to put it near
   /// slots_[start].
   IndexType allocateNear(IndexType start) {
-    for (auto tries = 0; tries < kMaxAllocationTries; ++tries) {
+    for (IndexType tries = 0; tries < kMaxAllocationTries; ++tries) {
       auto slot = allocationAttempt(start, tries);
       auto prev = slots_[slot].headAndState_.load(std::memory_order_acquire);
       if ((prev & 3) == EMPTY &&