title: Compute Modulus Division By A Power Of 2 Number
signature: function computeModulusDivisionByAPowerOf2Number(n: number, d: number): number {
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 ) );
  }
question_info.test_list: [{"idx": 0, "outputs": 50, "inputs": {"n": 54, "d": 59}}, {"idx": 1, "outputs": 3, "inputs": {"n": 39, "d": 84}}, {"idx": 2, "outputs": 0, "inputs": {"n": 35, "d": 81}}, {"idx": 3, "outputs": 9, "inputs": {"n": 9, "d": 60}}, {"idx": 4, "outputs": 2, "inputs": {"n": 62, "d": 68}}, {"idx": 5, "outputs": 0, "inputs": {"n": 16, "d": 16}}, {"idx": 6, "outputs": 93, "inputs": {"n": 93, "d": 96}}, {"idx": 7, "outputs": 32, "inputs": {"n": 32, "d": 38}}, {"idx": 8, "outputs": 37, "inputs": {"n": 39, "d": 62}}, {"idx": 9, "outputs": 15, "inputs": {"n": 63, "d": 16}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, d: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n, d),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(54, 59, 50);
    console.log(`TEST-0...${result}`);
  
    result = driver(39, 84, 3);
    console.log(`TEST-1...${result}`);
  
    result = driver(35, 81, 0);
    console.log(`TEST-2...${result}`);
  
    result = driver(9, 60, 9);
    console.log(`TEST-3...${result}`);
  
    result = driver(62, 68, 2);
    console.log(`TEST-4...${result}`);
  
    result = driver(16, 16, 0);
    console.log(`TEST-5...${result}`);
  
    result = driver(93, 96, 93);
    console.log(`TEST-6...${result}`);
  
    result = driver(32, 38, 32);
    console.log(`TEST-7...${result}`);
  
    result = driver(39, 62, 37);
    console.log(`TEST-8...${result}`);
  
    result = driver(63, 16, 15);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: computeModulusDivisionByAPowerOf2Number
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js