In the previous problem, we interleaved an 8-bit number into a 16-bit value by inserting 0s between each bit. Now your task is to:
Example Logic
16-bit input:
[b15 b14 ... b1 b0]
Extract bits at positions: 0, 2, 4, 6, 8, 10, 12, 14 → and shift into:
b0 b1 b2 b3 b4 b5 b6 b7
Example-1
Input: val = 20548 → Binary: 0101000001000100
Output: 202 (Binary: 11001010)
Example-2
Input: val = 21845 → Binary: 0101010101010101
Output: 255 (Binary: 11111111)
Example-3
Input: val = 1 → Binary: 0000000000000001
Output: 1
Input
20548
Expected Output
202