MCPcopy Create free account
hub / github.com/defold/defold / UpdateCRC16

Function UpdateCRC16

engine/hid/src/hid_guid.cpp:76–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76static uint16_t UpdateCRC16(uint16_t crc, const uint8_t* data, uint32_t data_length)
77{
78 for (uint32_t i = 0; i < data_length; ++i)
79 {
80 uint8_t r = (uint8_t) crc ^ data[i];
81 uint16_t byte_crc = 0;
82
83 for (uint32_t bit = 0; bit < 8; ++bit)
84 {
85 byte_crc = (uint16_t) ((((byte_crc ^ r) & 1) ? 0xA001 : 0) ^ (byte_crc >> 1));
86 r >>= 1;
87 }
88
89 crc = (uint16_t) (byte_crc ^ (crc >> 8));
90 }
91
92 return crc;
93}
94
95static uint16_t UpdateCRC16(uint16_t crc, const char* string)
96{

Callers 2

CreateGUIDFunction · 0.70
CreateGUIDFromIdentityFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected