title: Compute Modulus Division By A Power Of 2 Number
signature: func computeModulusDivisionByAPowerOf2Number(n int, d int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, d int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n, d),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(54, 
  	59, 50)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(39, 
  	84, 3)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(35, 
  	81, 0)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(9, 
  	60, 9)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(62, 
  	68, 2)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(16, 
  	16, 0)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(93, 
  	96, 93)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(32, 
  	38, 32)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(39, 
  	62, 37)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(63, 
  	16, 15)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def compute_modulus_division_by_a_power_of_2_number(n, d):
      return (n & (d - 1))
source_cpp: unsigned int compute_modulus_division_by_a_power_of_2_number(unsigned int n, unsigned int d) {
    return ( n & ( d - 1 ) );
  }