[ELF] Cast size to size_t. NFC
authorFangrui Song <i@maskray.me>
Wed, 26 Jan 2022 06:38:23 +0000 (22:38 -0800)
committerFangrui Song <i@maskray.me>
Wed, 26 Jan 2022 06:38:24 +0000 (22:38 -0800)
To fix

../../chromeclang/bin/../include/c++/v1/__algorithm/min.h:39:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long' vs. 'unsigned long long')

on macOS arm64.

lld/ELF/OutputSections.cpp

index f01f74f..e97d237 100644 (file)
@@ -351,7 +351,7 @@ template <class ELFT> void OutputSection::maybeCompress() {
   const size_t numShards = (size + shardSize - 1) / shardSize;
   auto shardsIn = std::make_unique<ArrayRef<uint8_t>[]>(numShards);
   for (size_t i = 0, start = 0, end; start != size; ++i, start = end) {
-    end = std::min(start + shardSize, size);
+    end = std::min(start + shardSize, (size_t)size);
     shardsIn[i] = makeArrayRef<uint8_t>(buf.get() + start, end - start);
   }