opnsense-src/sys/compat/linuxkpi/common/include
Doug Moore 6f309b9d56 log2: move log2 functions from linuxkpi to libkern
Linux has a header file that defines an ilog2 function and some simple
functions/macros that use it: roundup_pow_of_two, is_power_of_2,
rounddown_pow_of_two, and order_base_2.  This change moves three of
those simple functions (all but is_power_of_2) from linuxkpi to
libkern.  It also deletes a few implementations of these functions
that have previously been copied into code for various device drivers,
so that they can use the libkern version.  The is_power_of_2 macro was
not moved because powerof2 in param.h provides almost the same service
already (except that they disagree about whether 0 is a power of two).

Since the linux definitions of these functions were copied into
FreeBSD 11 years ago, linux has improved them, and this change
provides those improvements.  In particular, a giant table of log
values for evaluating ilog2 for constant values is no longer
necessary.

Reviewed by:	alc, markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D45536

(cherry picked from commit c8b0c33b03ac072413b27bed2bdae2ae27426f3a)
2025-02-10 04:29:23 -06:00
..
acpi LinuxKPI: Add acpi_dev_get_first_match_dev and acpi_device_handle 2024-08-02 00:15:51 +03:00
asm LinuxKPI: Add smp_store_release and smp_load_acquire functions 2024-08-02 00:09:41 +03:00
asm-generic linuxkpi: Add io.h 2022-08-08 15:22:35 +02:00
crypto LinuxKPI: add dummy hash.h and kernel_connect() 2023-05-12 11:21:10 +00:00
linux log2: move log2 functions from linuxkpi to libkern 2025-02-10 04:29:23 -06:00
net LinuxKPI: 802.11: adjustments for v6.11 iwlwifi, rtw88 and rtw89 2024-10-31 14:33:57 +00:00
video LinuxKPI: update linuxkpi_video to Linux 6.6 2024-08-11 13:12:38 +03:00
xen LinuxKPI: Add xen/xen.h header 2024-02-17 23:58:37 +03:00
stdarg.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00