From 541e9624eb69bb79f9d2f50c98a05445c54a220c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Oct 2018 12:58:23 -0400 Subject: common: Add function for checking word alignment to alignment.h This will be used in a following change to svcArbitrateLock() and svcArbitrateUnlock() --- src/common/alignment.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/common') diff --git a/src/common/alignment.h b/src/common/alignment.h index b3f103c07..d94a2291f 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -25,4 +25,10 @@ constexpr bool Is4KBAligned(T value) { return (value & 0xFFF) == 0; } +template +constexpr bool IsWordAligned(T value) { + static_assert(std::is_unsigned_v, "T must be an unsigned value."); + return (value & 0b11) == 0; +} + } // namespace Common -- cgit v1.2.3