2024年6月22日

摘要: #include <stdio.h> #include <stdint.h> // CRC-16-CCITT标准的多项式 #define POLY 0x1021 uint16_t crc16(uint16_t crc, const unsigned char *buffer, size_t len) 阅读全文
posted @ 2024-06-22 23:46 lydstory 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <stdint.h> uint16_t crc16(uint8_t *data, int length) { uint16_t crc = 0xFFFF; for (int i = 0; i < length; i++) { crc ^= da 阅读全文
posted @ 2024-06-22 13:11 lydstory 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 根据UTF-8编码规则,UTF-8字节序列以字节的高位位数来判断字节序列的长度,从而确定一个Unicode字符的开始和结束。 UTF-8的规则如下: 一个字节字符(ASCII字符)的第一个字节的最高位为0,后续7位用于表示字符的值。 两字节字符的第一个字节的前3位为110,后续5位用于表示字符的值; 阅读全文
posted @ 2024-06-22 10:41 lydstory 阅读(6) 评论(0) 推荐(0) 编辑

导航