HomeFreeBSD

libkern: avoid local var in order_base_2()

Description

libkern: avoid local var in order_base_2()

order_base_2(n) is implemented with a variable, which keeps it from
being used at file scope. Implement it instead as ilog2(2*n-1), which
produces a different result when 2*n overflows, which appears unlikely
in practice.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D46826

Details

Provenance
dougmAuthored on Sep 27 2024, 11:43 PM
Parents
rG86fc6f838ed2: pf: make pf_setup_pdesc() a static function
Branches
Unknown
Tags
Unknown