// file: ht_cstr_2.cc
//

// isip include files
//
#include "hash_table.h"
#include "hash_table_constants.h"
#include <string.h> 

// method: constructor
//
// arguments:
//  int_4 num : (input) number of elements to be hashed
//  int_4 mode : (input) mode of the table
//
// return: none
//
// this is an overloaded constructor for the class
//
Hash_table::Hash_table(int_4 num_a, char_1 mode_a) {

  // set the mode
  //
  mode_d = mode_a;

  // check border cases
  //
  if (num_a <= 0) {
    size_d = 0;
    cells_d = (Hash_cell**)NULL;
    return;
  }
  
  // set the hash table size to an appropriate power of 2
  //  
  int_4 final_size = 1;

  while (num_a > final_size) {
    final_size <<= 1;
  }
  size_d = final_size - 1;
  
  // set the hash table elements
  //
  if (size_d == 0) {
    size_d = 1;
  }
  cells_d = new Hash_cell*[size_d];
  memset(cells_d, 0, sizeof(Hash_cell*) * size_d);
  
  // exit gracefully
  //
}

