ACPICA: Utilities: Add ACPI_IS_POWER_OF_TWO()
authorLv Zheng <lv.zheng@intel.com>
Thu, 24 Mar 2016 01:40:56 +0000 (09:40 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 5 Apr 2016 01:53:33 +0000 (03:53 +0200)
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/cbcb7756
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/acmacros.h

index 411c18b7d541c8a9aa81b514af7b5f88f6d728af..b461f5568e8c4673fcf02a322d2250fd2542cbbf 100644 (file)
 
 #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
  * Bit positions start at zero.