瀏覽代碼

common: Add function for checking word alignment to alignment.h

This will be used in a following change to svcArbitrateLock() and
svcArbitrateUnlock()
Lioncash 7 年之前
父節點
當前提交
541e9624eb
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/common/alignment.h

+ 6 - 0
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