title: Swap All Odd And Even Bits
signature: fun swapAllOddAndEvenBits(x: Int): Int {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(x: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(x), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(99, 147)
      println("TEST-0...${result}")
      
      result = driver(94, 173)
      println("TEST-1...${result}")
      
      result = driver(11, 7)
      println("TEST-2...${result}")
      
      result = driver(3, 3)
      println("TEST-3...${result}")
      
      result = driver(77, 142)
      println("TEST-4...${result}")
      
      result = driver(57, 54)
      println("TEST-5...${result}")
      
      result = driver(54, 57)
      println("TEST-6...${result}")
      
      result = driver(66, 129)
      println("TEST-7...${result}")
      
      result = driver(98, 145)
      println("TEST-8...${result}")
      
      result = driver(36, 24)
      println("TEST-9...${result}")
      
          
  }
  
  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 );
  }