X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2FIndexedMemPool.h;fp=folly%2FIndexedMemPool.h;h=d1723039b30ca16bbdc94137f2ed4941e2eca39c;hp=bf35b559162e074b7b7ff7ba4e4e7daeb02712c5;hb=1c098e2758d1bd55c48ffa26dab389dbbe96a666;hpb=654cce1e5f5f4cadf3d6a05fe964d30d6120ffbc diff --git a/folly/IndexedMemPool.h b/folly/IndexedMemPool.h index bf35b559..d1723039 100644 --- a/folly/IndexedMemPool.h +++ b/folly/IndexedMemPool.h @@ -112,8 +112,9 @@ struct IndexedMemPool : boost::noncopyable { static constexpr uint32_t maxIndexForCapacity(uint32_t capacity) { // index of uint32_t(-1) == UINT32_MAX is reserved for isAllocated tracking - return std::min(uint64_t(capacity) + (NumLocalLists - 1) * LocalListLimit, - uint64_t(uint32_t(-1) - 1)); + return uint32_t(std::min( + uint64_t(capacity) + (NumLocalLists - 1) * LocalListLimit, + uint64_t(uint32_t(-1) - 1))); } static constexpr uint32_t capacityForMaxIndex(uint32_t maxIndex) { @@ -217,7 +218,7 @@ struct IndexedMemPool : boost::noncopyable { auto slot = reinterpret_cast( reinterpret_cast(elem) - offsetof(Slot, elem)); - auto rv = slot - slots_; + auto rv = uint32_t(slot - slots_); // this assert also tests that rv is in range assert(elem == &(*this)[rv]);