Logical and bitwise shift operations in C

The binary logarithm of n(log2n) is the power to which the number 2 must beraised to obtain the value n. Write a C function that calculates log2 of an unsigned integer n using the following approach: find the most significant setbit in n and return the position of this bit. For example, if n is 17 (0b10001),the function should return 4.

The C function should have the following signature:int myLog2(unsigned int n);