mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-28 12:30:58 +00:00
Update RMII ex, enhance MIP
This commit is contained in:
1 parent
c362af1f81
commit
bba361016d
7 files changed
+73
-90
No files matched your search
+8
-4
@@ -48,11 +48,16 @@ uint16_t mg_ntohs(uint16_t net) {
|
||||
}
|
||||
|
||||
uint32_t mg_crc32(uint32_t crc, const char *buf, size_t len) {
|
||||
int i;
|
||||
static const uint32_t crclut[16] = {
|
||||
// table for polynomial 0xEDB88320 (reflected)
|
||||
0x00000000, 0x1DB71064, 0x3B6E20C8, 0x26D930AC, 0x76DC4190, 0x6B6B51F4,
|
||||
0x4DB26158, 0x5005713C, 0xEDB88320, 0xF00F9344, 0xD6D6A3E8, 0xCB61B38C,
|
||||
0x9B64C2B0, 0x86D3D2D4, 0xA00AE278, 0xBDBDF21C};
|
||||
crc = ~crc;
|
||||
while (len--) {
|
||||
crc ^= *(unsigned char *) buf++;
|
||||
for (i = 0; i < 8; i++) crc = crc & 1 ? (crc >> 1) ^ 0xedb88320 : crc >> 1;
|
||||
uint8_t byte = *(uint8_t *)buf++;
|
||||
crc = crclut[(crc ^ byte) & 0x0F] ^ (crc >> 4);
|
||||
crc = crclut[(crc ^ (byte >> 4)) & 0x0F] ^ (crc >> 4);
|
||||
}
|
||||
return ~crc;
|
||||
}
|
||||
@@ -130,4 +135,3 @@ uint64_t mg_millis(void) {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user