Hello, I try to recode a CRC32 calcul function, but I don't know how to do it on B4A.
This is the code I would translate for B4A
My first parameter is an array of byte which contain my data, and the second in the size of my data.
Thanks =)
This is the code I would translate for B4A
B4X:
uint32_t crc32_compute(uint8_t const * p_data, uint32_t size, uint32_t const * p_crc)
{
uint32_t crc;
crc = (p_crc == NULL) ? 0xFFFFFFFF : ~(*p_crc);
for (uint32_t i = 0; i < size; i++)
{
crc = crc ^ p_data[i];
for (uint32_t j = 8; j > 0; j--)
{
crc = (crc >> 1) ^ (0xEDB88320U & ((crc & 1) ? 0xFFFFFFFF : 0));
}
}
return ~crc;
}
Thanks =)