Question: Implement the three functions in C unsigned int nget(unsigned int val, int position) This function should return the value of the nibble in position of
Implement the three functions in C


unsigned int nget(unsigned int val, int position) This function should return the value of the nibble in position of the integer. For instance, if x is: 1111 0000 0000 0000 0000 1011 1000 0010 Then nget (x,5) should return the value 1011, in binary (base-2) (which is the value 1110) Exercise 2: Modify nibbles. c to implement the nset function unsigned int nset(unsigned int val, unsigned int nVal, int position); The nibble at position in val should be set to nVal and the value returned. For instance, if x is: 0000 0000 0000 0000 0000 1011 1000 0010 Then, y = nset(x, Oxe, 6); would return: 0000 0000 0000 0000 0000 1011 1110 0010 Note that Oxe is hexadecimal for 11102 (or 1410) unsigned int nlrotate(unsigned int val) This function should rotate nibbles LEFT 4 bit positions (thus one nibble). The nibble in position O should be moved to nibble position 7. For example: X 0000 0000 0000 1000 0010 y = nlrotate(x); 1111 0000 0000 0000 1011 1000 0000 0000 1011 0010 1111 Note that the 1111, in nibble position 7 was originally the value of the left nibble
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
