Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ndk_compat/cpu-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ static uint32_t g_cpuIdArm;
#endif

static void set_cpu_mask_bit(uint32_t index, uint32_t* cpu_mask) {
*cpu_mask |= 1UL << index;
// cpu_mask is a 32-bit mask; a larger index would shift past its width
// (shifting by >= the operand width is undefined behavior). The range path
// in parse_cpu_mask bounds indices the same way.
if (index >= 32) return;
*cpu_mask |= (uint32_t)1 << index;
}

// Examples of valid inputs: "31", "4-31"
Expand Down