#pragma once
#include <atomic>
+#include <cstdint>
#include <functional>
+#include <limits>
#include <stdexcept>
#include <system_error>
#include <type_traits>
-#include <stdint.h>
+
+#include <boost/type_traits/has_trivial_destructor.hpp>
#include <folly/Bits.h>
#include <folly/Conv.h>
#include <folly/portability/SysMman.h>
#include <folly/portability/Unistd.h>
-#include <boost/type_traits/has_trivial_destructor.hpp>
-#include <limits>
-
namespace folly {
/// You're probably reading this because you are looking for an
}
private:
-
- enum {
+ enum : IndexType {
kMaxAllocationTries = 1000, // after this we throw
};
/// 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 &&