示例#1
0
unsigned int lzo_crc32(unsigned int c, const unsigned char* buf, unsigned int len)
{
    unsigned int crc;
#undef table
#if 1
#  define table lzo_crc32_table
#else
   const unsigned int * table = lzo_crc32_table;
#endif

    if (buf == 0)
        return 0;

    crc = (c & LZO_UINT32_C(0xffffffff)) ^ LZO_UINT32_C(0xffffffff);
    if (len >= 16) do
    {
        LZO_DO16(buf,0);
        buf += 16;
        len -= 16;
    } while (len >= 16);
    if (len != 0) do
    {
        LZO_DO1(buf,0);
        buf += 1;
        len -= 1;
    } while (len > 0);

    return crc ^ LZO_UINT32_C(0xffffffff);
#undef table
}
示例#2
0
lzo_crc32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len)
{
    lzo_uint32 crc;
#undef table
#if 1
#  define table lzo_crc32_table
#else
   const lzo_uint32 * table = lzo_crc32_table;
#endif

    if (buf == NULL)
        return 0;

    crc = (c & LZO_UINT32_C(0xffffffff)) ^ LZO_UINT32_C(0xffffffff);
    if (len >= 16) do
    {
        LZO_DO16(buf,0);
        buf += 16;
        len -= 16;
    } while (len >= 16);
    if (len != 0) do
    {
        LZO_DO1(buf,0);
        buf += 1;
        len -= 1;
    } while (len > 0);

    return crc ^ LZO_UINT32_C(0xffffffff);
#undef table
}