previous | start | next

A C function getLSByte(int x)

Use only 1 byte constants in your code.

Allowable operators: ! ~ & ^ | + << >>

int getLSByte(int x)

This function should return an integer with the least significant byte equal to the least significant byte of x and the other bytes should be 0.
Example: if x = 0x12345678, getLSByte(x) should return 0x00000078.


    1   int getLSByte(int x)
    2   {
    3     int mask = 0x000000FF;
    4     return x & mask;
    5   }


previous | start | next