From 258f74fb2a30dc6367f5dd05bd8e385c94aa16be Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Fri, 17 Jun 2022 21:00:27 -0700 Subject: [PATCH] Fix MSVC warning with cast. --- src/gpgmm/common/SlabMemoryAllocator.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gpgmm/common/SlabMemoryAllocator.cpp b/src/gpgmm/common/SlabMemoryAllocator.cpp index ce6243e0e..fba557d7c 100644 --- a/src/gpgmm/common/SlabMemoryAllocator.cpp +++ b/src/gpgmm/common/SlabMemoryAllocator.cpp @@ -181,7 +181,8 @@ namespace gpgmm { // Get the next free slab. if (mLastUsedSlabSize > 0) { uint64_t newSlabSize = - std::min(ComputeSlabSize(request.SizeInBytes, slabSize * mSlabGrowthFactor, + std::min(ComputeSlabSize(request.SizeInBytes, + static_cast(slabSize * mSlabGrowthFactor), request.AvailableForAllocation), mMaxSlabSize); @@ -296,10 +297,11 @@ namespace gpgmm { // If a subsequent TryAllocateMemory() uses a request size different than the current // request size, memory required for the next slab could be the wrong size. If so, // pre-fetching did not pay off and the pre-fetched memory will be de-allocated instead. - uint64_t nextSlabSize = - std::min(ComputeSlabSize(request.SizeInBytes, mLastUsedSlabSize * mSlabGrowthFactor, - request.AvailableForAllocation), - mMaxSlabSize); + uint64_t nextSlabSize = std::min( + ComputeSlabSize(request.SizeInBytes, + static_cast(mLastUsedSlabSize * mSlabGrowthFactor), + request.AvailableForAllocation), + mMaxSlabSize); // If under growth phase (and accounting that the current slab will soon become // full), reset the slab size back to the last size. Otherwise, the pre-fetch will