On Wed, Mar 4, 2015 at 10:30 PM, Gerd Hoffmann <kra...@redhat.com> wrote:

> +/* round up to the nearest power of 2 (0 if overflow) */
> +uint64_t pow2ceil(uint64_t value)
> +{
> +    uint8_t nlz = clz64(value);
> +
> +    if (is_power_of_2(value)) {
> +        return value;
> +    }
> +    if (!nlz) {
> +        return 0;
> +    }
> +    return 1ULL << (64 - nlz);
> +}
> +
>


please call clz64 after is_power_of_2.

Reply via email to