Page MenuHomeFreeBSD

roundup_pow_of_two: use ispower instead
ClosedPublic

Authored by dougm on Sep 28 2024, 7:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 1, 1:50 PM
Unknown Object (File)
Thu, Oct 24, 5:43 AM
Unknown Object (File)
Oct 4 2024, 10:41 AM
Unknown Object (File)
Sep 29 2024, 3:20 PM
Unknown Object (File)
Sep 29 2024, 6:39 AM
Unknown Object (File)
Sep 28 2024, 9:27 PM
Subscribers

Details

Summary

The fastest way to check if a number is a power of two is not to compute roundup_pow_of_two; it is to use ispower2 (param.h) or is_power_of_2 (log2.h in linux). Do that in two places.

Also, in one place, use order_base_2 instead of ilog2(roundup_pow_of_two()).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable