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)
Feb 6 2025, 4:32 PM
Unknown Object (File)
Jan 31 2025, 4:35 AM
Unknown Object (File)
Jan 25 2025, 11:28 AM
Unknown Object (File)
Jan 6 2025, 10:39 AM
Unknown Object (File)
Dec 4 2024, 11:57 PM
Unknown Object (File)
Nov 28 2024, 8:21 PM
Unknown Object (File)
Nov 6 2024, 9:29 AM
Unknown Object (File)
Nov 6 2024, 9:25 AM
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