[Solved] How to change place of the next bits?(use only bit operations)
From what I see, it seems that you need a function that swaps position of every 2 bits in a number. few examples: 10’00’11’01’01 -> 01’00’11’10’10 11’01’10’10’11 -> 11’10’01’01’11 for this operation, a very simple function is following: unsigned int change_bit(unsigned int num) { return ((num & 0xAAAAAAAA) >> 1) | ((num & 0x55555555) << … Read more