Skip to content

Commit 3e935cf

Browse files
Cast GetCachedTID() to unsigned to prevent left-shifting a negative number.
PiperOrigin-RevId: 776628229
1 parent 1af7fd4 commit 3e935cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/google/protobuf/arenaz_sampler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void RecordAllocateSlow(ThreadSafeArenaStats* info, size_t used,
110110
if (info->max_block_size.load(std::memory_order_relaxed) < allocated) {
111111
info->max_block_size.store(allocated, std::memory_order_relaxed);
112112
}
113-
const uint64_t tid = 1ULL << (GetCachedTID() % 63);
113+
const uint64_t tid = 1ULL << (static_cast<uint64_t>(GetCachedTID()) % 63);
114114
info->thread_ids.fetch_or(tid, std::memory_order_relaxed);
115115
}
116116

0 commit comments

Comments
 (0)