Nios/shiftu

From ASMBits

nios/addPrevious

One common case where you need to shift and truncate numbers is when converting digital audio samples between samples of different sizes, while trying to preserve most of the information about the audio sample.

For this problem, write a function (named shift) that converts one unsigned 32-bit audio sample to unsigned 8-bit format, and returns the converted sample. As a result, the least-significant 24 bits of the sample are lost (truncation). Don't do any rounding.

Expected solution length: Around 2 lines.

Sample Input

0x12345678

Sample Output

0x12

Write your solution here

Upload a source file...