11 Replies Latest reply on Jan 16, 2008 4:43 PM by 807603

    bit manipulation - converting int value to 4 bits

      Is there someway of converting int values to a set number of bits without affecting the other bits in the byte.
      If I have a byte and I the first 3 bits are reserved and the other 5 bits represent a number.

      So I need convert a number to the 5 bits without changing the values in the first 3 bits.

      It could also be that I have 2 bytes and 12 bits are for a number and 4 are reserved.

      I have been looking for answers but cannot find a solution.