Nios/mask

From ASMBits

nios/pow2Previous

A 32-bit binary number contains 32 binary digits, each of which is 0 or 1. Write a function that will return a 32-bit number where the lowest N bits are 1 and the upper 32-N bits are 0.

N will be between 0 and 32.

unsigned int mask(unsigned int N);

Expected solution length: Around 4 lines.

Sample Input

mask(4)

Sample Output

r2=0xf

Write your solution here

Upload a source file...