In embedded systems, multiple configuration fields are often packed into a single register using bit-level operations.
You are given the following field specifications to be packed into a 16-bit control register:
Your task is to:
Example-1
Input: mode = 3, speed = 10, status = 12 Output: 12371 (Hex: 0x3053, Binary: 0011000001010011)
Example-2
Input: mode = 7, speed = 31, status = 63 Output: 64767 (Hex: 0xFCFF, Binary: 1111110011111111)
Example-3
Input: mode = 4, speed = 16, status = 8 Output: 8324 (Hex: 0x2084, Binary: 0010000010000100)
Test Cases
Test Results
Input
3 10 12
Expected Output
12371