diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_size_class_map.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_size_class_map.h index 2bd83b2eb5a4..52e82b81aac8 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_size_class_map.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_size_class_map.h @@ -163,7 +163,7 @@ class SizeClassMap { return (size + kMinSize - 1) >> kMinSizeLog; uptr l = MostSignificantSetBitIndex(size); uptr hbits = (size >> (l - S)) & M; - uptr lbits = size & ((1 << (l - S)) - 1); + uptr lbits = size & ((1U << (l - S)) - 1); uptr l1 = l - kMidSizeLog; return kMidClass + (l1 << S) + hbits + (lbits > 0); } @@ -176,7 +176,8 @@ class SizeClassMap { return 16; if (UNLIKELY(class_id == 0)) return 0; - uptr n = (1UL << kMaxBytesCachedLog) / Size(class_id); + const uptr n = + (1U << kMaxBytesCachedLog) / static_cast(Size(class_id)); return Max(1, Min(kMaxNumCachedHint, n)); }