CRC32 code in SDK

[Copy Link]
Author: jeroenD | Time: 2021-9-16 22:01:45 | Others|
1 2701

2

Threads

4

Posts

50

Credits

Pre-School

Rank: 2

Credits
50
Posted on 2021-9-16 22:01:45| All floors |Read mode
Hello,

could it be that there is an error in the Livox example code to generate the 32bit CRC checksum?

while (((uintptr_t)data & 3) && len) {
                crc = (crc >> 8) ^ CRC_TABLE_CRC32[(crc & 0xff) ^ *data++];
                len--;
        }


((uintptr_t)data is the address of the variable , and will change every run, and is device dependent. However, since everything is stored on even address numbers, this & 3 will always be 0 and the while will never be taken.

JeroenD
Reply

Use props Report

2

Threads

267

Posts

1079

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
1079
Posted on 2021-9-24 17:41:57| All floors
You can refer to the following link:
https://github.com/Livox-SDK/Liv ... third_party/FastCRC
Reply

Use props Report

You need to log in before you can reply Login | Register

Credit Rules

Quick Reply Back to top