title: Next Power Of 2 2
signature: next_power_of_2_2 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          63L, 
          64L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          78L, 
          128L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          13L, 
          16L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          5L, 
          8L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          34L, 
          64L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          69L, 
          128L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          63L, 
          64L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          78L, 
          128L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          80L, 
          128L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          19L, 
          32L
      )))
  
  }
  
  main()
source_py: def next_power_of_2_2(n):
      n -= 1
      n |= (n >> 1)
      n |= (n >> 2)
      n |= (n >> 4)
      n |= (n >> 8)
      n |= (n >> 16)
      n += 1
      return n
source_cpp: unsigned int next_power_of_2_2(unsigned int n) {
    n --;
    n |= n >> 1;
    n |= n >> 2;
    n |= n >> 4;
    n |= n >> 8;
    n |= n >> 16;
    n ++;
    return n;
  }