~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/algorithm/crc32.cc

  • Committer: Siddharth Prakash Singh
  • Date: 2010-03-29 19:59:44 UTC
  • mto: This revision was merged to the branch mainline in revision 1432.
  • Revision ID: spsneo@spsneo-laptop-20100329195944-n4zv64b1lr2a68e5
branch for templatizing drizzled::algorithm::crc32()

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
  0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
107
107
};
108
108
 
109
 
uint32_t crc32(const char *key, size_t key_length)
110
 
{
111
 
  uint64_t x;
112
 
  uint32_t crc= UINT32_MAX;
113
 
 
114
 
  for (x= 0; x < key_length; x++)
115
 
    crc= (crc >> 8) ^ crc32tab[(crc ^ static_cast<uint8_t>(key[x])) & 0xff];
116
 
 
117
 
  return ~crc;
118
 
}
119
 
 
120
109
} /* namespace algorithm */
121
110
} /* namespace drizzled */