Skip to content

SCX eBPF function log2_u64

v6.12

The log2_u64 function computes the base 2 logarithm of a 64-bit exponential value.

Definition

static inline u32 log2_u64(u64 v)
{
        u32 hi = v >> 32;
        if (hi)
                return log2_u32(hi) + 32 + 1;
        else
                return log2_u32(v) + 1;
}

Usage

Compute the base 2 logarithm of a 64-bit value.

Parameters

  • v: The value for which we're computing the base 2 logarithm.

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome