Commit a8d1e1c0 authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki

ACPICA: Utilities: Add ACPI_IS_POWER_OF_TWO()

ACPICA commit cbcb77565c5032dd48e19b3a8a8b8704c5f29faf

This patch adds a macro ACPI_IS_POWER_OF_TWO, which can be used to
detect if a number is a power of two. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/cbcb7756Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7447bc1e
...@@ -260,6 +260,10 @@ ...@@ -260,6 +260,10 @@
#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1)) #define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
/* Generic (power-of-two) rounding */
#define ACPI_IS_POWER_OF_TWO(a) (((a) & ((a) - 1)) == 0)
/* /*
* Bitmask creation * Bitmask creation
* Bit positions start at zero. * Bit positions start at zero.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment