Reformat code

This commit is contained in:
Mario Hüttel 2021-08-24 21:50:57 +02:00
parent 809c86a618
commit 5a1deeb9ee

View File

@ -1,12 +1,11 @@
#include <error-mem-viewer/crc.h> #include <error-mem-viewer/crc.h>
uint32_t do_crc(uint32_t init, uint32_t data) static uint32_t do_crc(uint32_t init, uint32_t data)
{ {
uint32_t crc = init; uint32_t crc = init;
uint32_t cnt; uint32_t cnt;
for(cnt=0; cnt < 32; cnt++) for (cnt=0; cnt < 32; cnt++) {
{
crc = ((int32_t)(crc ^ data))<0 ? (crc << 1) ^ 0x04C11DB7 : crc << 1; crc = ((int32_t)(crc ^ data))<0 ? (crc << 1) ^ 0x04C11DB7 : crc << 1;
data <<=1; data <<=1;
} }
@ -18,7 +17,7 @@ uint32_t calculate_stm_crc(uint32_t *data, size_t len)
{ {
uint32_t crc = ~0U; uint32_t crc = ~0U;
while(len--) { while (len--) {
crc = do_crc(crc, *data++); crc = do_crc(crc, *data++);
} }