/* This file is part of the Simba project.  */
uint32_t crc_32(uint32_t crc, const void *buf_p, size_t size)
/* This file is part of the Simba project.  */
uint32_t crc_32(uint32_t crc, const void *buf_p, size_t size)
{
    ASSERTN(buf_p != NULL, EINVAL);
    const uint8_t *b_p;
    size_t i;
    b_p = buf_p;
    crc ^= 0xfffffffful;
    while (size > 0) {
        crc = (crc ^ *b_p++);
        for (i = 0; i < 8; i++) {
            crc = (crc >> 1) ^ (0xedb88320 & (-(crc & 1)));
        }
        size--;
    }
    return (~crc);
}