摘要: 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... 阅读全文
posted @ 2010-12-31 14:39 napoleon_liu 阅读(249) 评论(0) 推荐(0) 编辑
摘要: wiki上的说明:http://en.wikipedia.org/wiki/Time_Stamp_Counter intel 有的CPU tsc的变化是固定的(不会随 cpu节电的影响)。  判断CPU是否支持常量TSC,可以使用 “cat /proc/cpuinfo | grep constant_tsc“, 有输出就表示支持。   下面是tsc的读取代码,  cpuid是为了解决CPU乱... 阅读全文
posted @ 2010-12-31 10:02 napoleon_liu 阅读(546) 评论(2) 推荐(0) 编辑