📄 ht_hash_4.cc
字号:
// file: ht_hash_3.cc//// isip include files//#include "hash_table.h"#include "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 Hash_table::hash_vector_cc(int_4* vec_a, int_4 size_a) { // index variable // uint_4 index = (uint_4)0; uint_4 mask = size_d; // create the index for the given string using a concocted hash // function based loosely on the one obtained at // http://ourworld.compuserve.com/homepages/bob_jenkins/doobs.htm // for (int_4 i = 0; i < size_a; i++) { index += vec_a[i]; index += (index << 10); index ^= (index >> 6); } index += (index << 3); index ^= (index >> 11); index += (index << 15); // mask the hash index // index %= mask; // exit gracefully // return (int_4)index;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -