Nios/shiftl

From ASMBits

nios/shiftsPrevious

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 signed 16-bit audio sample to signed 32-bit format, and returns the converted sample. (This is equivalent to increasing the amplitude by 65536 times.) As a result of the conversion, the low 16 bits of the result become zero.

Expected solution length: Around 2 lines.

Sample Input

0x1234

Sample Output

0x12340000

Write your solution here

Upload a source file...