Browse Source

Use standard alignof

Kajetan Johannes Hammerle 1 month ago
parent
commit
5b19e1fedf
1 changed files with 2 additions and 4 deletions
  1. 2 4
      include/core/utils/AlignedData.hpp

+ 2 - 4
include/core/utils/AlignedData.hpp

@@ -1,12 +1,10 @@
 #ifndef CORE_ALIGNED_DATA_HPP
 #define CORE_ALIGNED_DATA_HPP
 
-#define alignmentof(type) __alignof__(type)
-
 #define CORE_ASSERT_ALIGNED_DATA(var, type)                                    \
     static_assert(sizeof(var) == sizeof(type), "aligned data size missmatch"); \
     static_assert(var.getSize() >= var.getAlignment(), "size >= alignment");   \
-    static_assert(alignmentof(var) == alignmentof(type),                       \
+    static_assert(alignof(decltype(var)) == alignof(type),                     \
                   "aligned data alignment missmatch");
 
 namespace Core {
@@ -36,7 +34,7 @@ namespace Core {
     };
 
     template<typename T>
-    using AlignedType = AlignedData<sizeof(T), alignmentof(T)>;
+    using AlignedType = AlignedData<sizeof(T), alignof(T)>;
 }
 
 #endif