// file: tr_ht_hash_4.cc
//

// isip include files
//
#include "train_hash_table.h"
#include "train_hash_table_constants.h"
 
// method: hash_vector_cc
//
// arguments:
//  int_4* vec : (input) the vector to be hashed
//  int_4 size : (input) the length of the vector
//
// return: an int_4 with the hash index
//
// this method computes the hash index for the given vector
//
int_4 Train_Hash_table::hash_vector_cc(int_4* vec_a, int_4 size_a) {

  // index variable
  //
  uint_4 index = (uint_4)0;

  // create the index for the given string
  //
  for (int_4 i = 0; i < size_a; i++) {
    index = vec_a[i] + TRAIN_HASH_TABLE_FACTOR * index;
  }
  index = index % (uint_4)size_d;
  
  // exit gracefully
  //
  return (int_4)index;

}
