/* Attention! The len must be a multiple of 4 * sizeof(long) due to restriction of optimizations in this function.  */
bool buffer_is_zero(const void *buf, size_t len)
/* Attention! The len must be a multiple of 4 * sizeof(long) due to restriction of optimizations in this function.  */
bool buffer_is_zero(const void *buf, size_t len)
{
    size_t i;
    long d0, d1, d2, d3;
    const long * const data = buf;
    if (can_use_buffer_find_nonzero_offset(buf, len)) {
        return buffer_find_nonzero_offset(buf, len) == len;
    }
    assert(len % (4 * sizeof(long)) == 0);
    len /= sizeof(long);
    for (i = 0; i < len; i += 4) {
        d0 = data[i + 0];
        d1 = data[i + 1];
        d2 = data[i + 2];
        d3 = data[i + 3];
        if (d0 || d1 || d2 || d3) {
            return false;
        }
    }
    return true;
}