for example 10'00'11'01'01 -> 01'00'11'10'10
void main() {
  unsigned int num = 78;
  unsigned int num2 = change_bit(num);
  printf("%d\n", num2); //141
}
I need a function like that.
for example 10'00'11'01'01 -> 01'00'11'10'10
void main() {
  unsigned int num = 78;
  unsigned int num2 = change_bit(num);
  printf("%d\n", num2); //141
}
I need a function like that.
 
    
     
    
    From what I see, it seems that you need a function that swaps position of every 2 bits in a number. few examples:
for this operation, a very simple function is following:
unsigned int change_bit(unsigned int num)
{
    return ((num & 0xAAAAAAAA) >> 1) | ((num & 0x55555555) << 1);
}
