[compiler-rt] f83f712 - [scudo][NFC] Explicit type casting to avoid compiler warning (#83355)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 16:15:35 PST 2024


Author: ChiaHungDuan
Date: 2024-02-28T16:15:31-08:00
New Revision: f83f7128b3c98e5d1d1995bfa18c43c6b32c18bb

URL: https://github.com/llvm/llvm-project/commit/f83f7128b3c98e5d1d1995bfa18c43c6b32c18bb
DIFF: https://github.com/llvm/llvm-project/commit/f83f7128b3c98e5d1d1995bfa18c43c6b32c18bb.diff

LOG: [scudo][NFC] Explicit type casting to avoid compiler warning (#83355)

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/allocator_common.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/allocator_common.h b/compiler-rt/lib/scudo/standalone/allocator_common.h
index 4d39956bf90503..2b77516ad11cae 100644
--- a/compiler-rt/lib/scudo/standalone/allocator_common.h
+++ b/compiler-rt/lib/scudo/standalone/allocator_common.h
@@ -53,7 +53,7 @@ template <class SizeClassAllocator> struct TransferBatch {
   void moveNToArray(CompactPtrT *Array, u16 N) {
     DCHECK_LE(N, Count);
     memcpy(Array, Batch + Count - N, sizeof(Batch[0]) * N);
-    Count -= N;
+    Count = static_cast<u16>(Count - N);
   }
   u16 getCount() const { return Count; }
   bool isEmpty() const { return Count == 0U; }


        


More information about the llvm-commits mailing list