Remove ALIGN_32 macro

It's never used in expressions like SIZE_32(T) * n, so it doesn't help to fix any warning issued due to truncation.
This commit is contained in:
Nekotekina 2018-08-31 16:47:30 +03:00
parent dea5193fd7
commit 69f0ad0d68
4 changed files with 6 additions and 9 deletions

View File

@ -43,9 +43,6 @@
// Return 32 bit sizeof() to avoid widening/narrowing conversions with size_t
#define SIZE_32(...) static_cast<u32>(sizeof(__VA_ARGS__))
// Return 32 bit alignof() to avoid widening/narrowing conversions with size_t
#define ALIGN_32(...) static_cast<u32>(alignof(__VA_ARGS__))
// Variant pattern matching helper
#define MATCH(arg, ...) constexpr(std::is_same_v<std::decay_t<decltype(arg)>, __VA_ARGS__>)

View File

@ -152,8 +152,8 @@ public:
info.name = name;
info.var = reinterpret_cast<vm::gvar<void>*>(Var);
info.init = [] {};
info.size = SIZE_32(typename T::type);
info.align = ALIGN_32(typename T::type);
info.size = sizeof(typename T::type);
info.align = alignof(typename T::type);
info.type = typeid(T).name();
info.flags = 0;
info.addr = 0;

View File

@ -121,7 +121,7 @@ namespace vm
// Test address alignment using alignof(T)
bool aligned() const
{
return aligned(ALIGN_32(T));
return aligned(alignof(T));
}
// Get type size
@ -133,7 +133,7 @@ namespace vm
// Get type alignment
static constexpr u32 align()
{
return ALIGN_32(T);
return alignof(T);
}
// Test address for arbitrary alignment: (addr & (align - 1)) != 0

View File

@ -40,7 +40,7 @@ namespace vm
public:
_var_base()
: pointer(A::alloc(SIZE_32(T), ALIGN_32(T)))
: pointer(A::alloc(SIZE_32(T), alignof(T)))
{
}
@ -72,7 +72,7 @@ namespace vm
public:
_var_base(u32 count)
: pointer(A::alloc(SIZE_32(T) * count, ALIGN_32(T)))
: pointer(A::alloc(SIZE_32(T) * count, alignof(T)))
, m_size(SIZE_32(T) * count)
{
}