18 #ifndef PAGESPEED_KERNEL_BASE_ROLLING_HASH_H_ 
   19 #define PAGESPEED_KERNEL_BASE_ROLLING_HASH_H_ 
   22 #include "base/logging.h" 
   25 namespace net_instaweb {
 
   34 uint64 
RollingHash(
const char* buf, 
size_t start, 
size_t n);
 
   46     const char* buf, 
size_t start, 
size_t n, uint64 prev) {
 
   49   CHECK_LT(static_cast<size_t>(0), start);
 
   54   uint64 prev_rot1 = (prev << 1) | (prev >> 63); 
 
   55   uint64 start_hash_rotn;
 
   59   size_t shift = n % 64;
 
   61     start_hash_rotn = start_hash;
 
   64     start_hash_rotn = (start_hash << shift) | (start_hash >> (64 - shift));
 
   66   return (start_hash_rotn ^ prev_rot1 ^ end_hash);
 
uint64 NextRollingHash(const char *buf, size_t start, size_t n, uint64 prev)
Definition: rolling_hash.h:45
uint64 RollingHash(const char *buf, size_t start, size_t n)
Compute the rolling hash of buf[start : start + n - 1]. 
const uint64 kRollingHashCharTable[256]
Per character hash values. Exported for use in NextRollingHash.