Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static unsafe void Calc_crc32(long* crc32, char* mem, int ln, int fl)
- {
- long fcs;
- int i, ii, iii;
- if ((fl & 1) == 1)
- fcs = -1;
- else
- fcs = *crc32;
- for (i = 0; i < ln; i++)
- {
- iii = mem[i];
- for (ii = 0; i < 8; i++)
- {
- if ((fcs & 1) == 1)
- {
- fcs >>= 1;
- if ((iii & 1) == 1)
- fcs |= 0x80000000;
- else
- fcs &= 0x7FFFFFFF;
- fcs ^= 0XEDB88320;
- }
- else
- {
- fcs >>= 1;
- if ((iii & 1) == 1)
- fcs |= 0x80000000;
- else
- fcs &= 0x7FFFFFFF;
- }
- iii >>= 1;
- }
- }
- if ((fl & 2) == 1)
- {
- for (i = 0; i < 32; i++)
- {
- if ((fcs & 1) == 1)
- {
- fcs >>= 1;
- fcs &= 0x7FFFFFFF;
- fcs ^= 0xEDB88320;
- }
- else
- {
- fcs >>= 1;
- fcs &= 0x7FFFFFFF;
- }
- }
- fcs ^= -1;
- }
- *crc32 = fcs;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement