diff options
author | Lioncash <mathew1800@gmail.com> | 2018-10-18 12:58:23 -0400 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-10-18 12:58:27 -0400 |
commit | 541e9624eb69bb79f9d2f50c98a05445c54a220c (patch) | |
tree | 19b730079e658c712ed6e6257dd2fc7dbc044955 /src/common/alignment.h | |
parent | d27f4a4928f493f9e7a2987ad93e6be918b70f6c (diff) |
common: Add function for checking word alignment to alignment.h
This will be used in a following change to svcArbitrateLock() and
svcArbitrateUnlock()
Diffstat (limited to 'src/common/alignment.h')
-rw-r--r-- | src/common/alignment.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h index b3f103c079..d94a2291f7 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 <typename T> +constexpr bool IsWordAligned(T value) { + static_assert(std::is_unsigned_v<T>, "T must be an unsigned value."); + return (value & 0b11) == 0; +} + } // namespace Common |