H Hirogens Active Member Licensed User Longtime User Jun 14, 2018 #1 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 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; } My first parameter is an array of byte which contain my data, and the second in the size of my data. Thanks =)
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 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; } My first parameter is an array of byte which contain my data, and the second in the size of my data. Thanks =)
H Hirogens Active Member Licensed User Longtime User Jun 14, 2018 #2 It's okay I find a solution ! Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jun 14, 2018 #3 Always better to post the solution... Upvote 0