#include "folly/Malloc.h"
-#if defined(__GNUC__) && defined(__x86_64__)
+#if defined(__GNUC__) && FOLLY_X64
# include "folly/SmallLocks.h"
# define FB_PACKED __attribute__((packed))
#else
IntegralSizePolicy() : size_(0) {}
protected:
- std::size_t policyMaxSize() const {
+ static constexpr std::size_t policyMaxSize() {
return SizeType(~kExternMask);
}
SizeType size_;
};
-#ifdef __x86_64__
+#if FOLLY_X64
template<class SizeType, bool ShouldUseHeap>
struct OneBitMutexImpl {
typedef SizeType InternalSizeType;
protected:
static bool const kShouldUseHeap = ShouldUseHeap;
- std::size_t policyMaxSize() const {
+ static constexpr std::size_t policyMaxSize() {
return SizeType(~(SizeType(1) << kLockBit | kExternMask));
}
return std::lexicographical_compare(begin(), end(), o.begin(), o.end());
}
- size_type max_size() const {
+ static constexpr size_type max_size() {
return !BaseType::kShouldUseHeap ? MaxInline
- : this->policyMaxSize();
+ : BaseType::policyMaxSize();
}
size_type size() const { return this->doSize(); }
doConstruct(n, val);
}
- void makeSize(size_type size, value_type* v = NULL) {
+ void makeSize(size_type size, value_type* v = nullptr) {
makeSize(size, v, size - 1);
}
detail::shiftPointer(newh, kHeapifyCapacitySize) :
newh);
- if (v != NULL) {
+ if (v != nullptr) {
// move new element
try {
new (&newp[pos]) value_type(std::move(*v));
}
} FB_PACKED;
-#if defined(__x86_64_)
+#if FOLLY_X64
typedef unsigned char InlineStorageType[sizeof(value_type) * MaxInline];
#else
typedef typename std::aligned_storage<