Skip to content

Commit

Permalink
ACPICA: Utilities: Add ACPI_IS_POWER_OF_TWO()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lv Zheng authored and Rafael J. Wysocki committed Apr 5, 2016
1 parent 7447bc1 commit a8d1e1c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/acpi/acpica/acmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@

#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.
Expand Down

0 comments on commit a8d1e1c

Please sign in to comment.