in resolution of [Wsign-compare] warning id 10

LargeAllocationWarningBytes() is implied to be a quantity ( it calls AvailableRam(), which unless improperly named, is a quantity/ i.e. non-negative ). 

Given LargeAllocationWarningBytes() is a quantity, it can be cast to size_t with behavior constrained to be as-intend.
This commit is contained in:
tg-at-google 2020-06-02 10:59:06 -04:00 committed by GitHub
parent 4f0fc47dd2
commit 1499585ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,7 @@ class CPUAllocator : public Allocator {
string Name() override { return "cpu"; }
void* AllocateRaw(size_t alignment, size_t num_bytes) override {
if (num_bytes > LargeAllocationWarningBytes() &&
if (num_bytes > static_cast<size_t>(LargeAllocationWarningBytes()) &&
single_allocation_warning_count_ < kMaxSingleAllocationWarnings) {
++single_allocation_warning_count_;
LOG(WARNING) << "Allocation of " << num_bytes << " exceeds "