title: Swap All Odd And Even Bits
signature: swap_all_odd_and_even_bits <- function(x) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(x, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(x), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          99L, 
          147L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          94L, 
          173L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          11L, 
          7L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          3L, 
          3L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          77L, 
          142L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          57L, 
          54L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          54L, 
          57L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          66L, 
          129L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          98L, 
          145L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          36L, 
          24L
      )))
  
  }
  
  main()
source_py: def swap_all_odd_and_even_bits(x):
      even_bits = (x & 2863311530)
      odd_bits = (x & 1431655765)
      even_bits >>= 1
      odd_bits <<= 1
      return (even_bits | odd_bits)
source_cpp: unsigned int swap_all_odd_and_even_bits(unsigned int x) {
    unsigned int even_bits = x & 0xAAAAAAAA;
    unsigned int odd_bits = x & 0x55555555;
    even_bits >>= 1;
    odd_bits <<= 1;
    return ( even_bits | odd_bits );
  }