diff options
| author | 2018-10-18 12:58:23 -0400 | |
|---|---|---|
| committer | 2018-10-18 12:58:27 -0400 | |
| commit | 541e9624eb69bb79f9d2f50c98a05445c54a220c (patch) | |
| tree | 19b730079e658c712ed6e6257dd2fc7dbc044955 | |
| parent | common: Move Is4KBAligned() to alignment.h (diff) | |
| download | yuzu-541e9624eb69bb79f9d2f50c98a05445c54a220c.tar.gz yuzu-541e9624eb69bb79f9d2f50c98a05445c54a220c.tar.xz yuzu-541e9624eb69bb79f9d2f50c98a05445c54a220c.zip | |
common: Add function for checking word alignment to alignment.h
This will be used in a following change to svcArbitrateLock() and
svcArbitrateUnlock()
| -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 b3f103c07..d94a2291f 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h | |||
| @@ -25,4 +25,10 @@ constexpr bool Is4KBAligned(T value) { | |||
| 25 | return (value & 0xFFF) == 0; | 25 | return (value & 0xFFF) == 0; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | template <typename T> | ||
| 29 | constexpr bool IsWordAligned(T value) { | ||
| 30 | static_assert(std::is_unsigned_v<T>, "T must be an unsigned value."); | ||
| 31 | return (value & 0b11) == 0; | ||
| 32 | } | ||
| 33 | |||
| 28 | } // namespace Common | 34 | } // namespace Common |