摘要:
php, apache, perl, bsddb都使用time33哈希. 最简单的版本 uint32_t time33(char const *str, int len) { uint32_t hash = 0; for (int i = 0; i len; i++) { hash = hash *33 + (unsi... 阅读全文
摘要:
wiki上的说明:http://en.wikipedia.org/wiki/Time_Stamp_Counter intel 有的CPU tsc的变化是固定的(不会随 cpu节电的影响)。 判断CPU是否支持常量TSC,可以使用 “cat /proc/cpuinfo | grep constant_tsc“, 有输出就表示支持。 下面是tsc的读取代码, cpuid是为了解决CPU乱... 阅读全文