Skip to content

Commit bb2a116

Browse files
author
zhengyu.gu
committed
Added assertion for potential mapped thread id overflow
1 parent cc95793 commit bb2a116

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

ddprof-lib/src/main/cpp/threadFilter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ void ThreadFilter::clear() {
8686
}
8787

8888
int ThreadFilter::mapThreadId(int thread_id) {
89+
// We want to map the thread_id inside the same bitmap
90+
static_assert(BITMAP_SIZE >= (u16)0xffff, "Potential verflow");
8991
u16 lower16 = (u16)(thread_id & 0xffff);
9092
lower16 = ((lower16 & 0x00ff) << 8) | ((lower16 & 0xff00) >> 8);
9193
int tid = (thread_id & ~0xffff) | lower16;

0 commit comments

Comments
 (0)