mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-24 08:33:39 +00:00
Added template function alignof() which provides a clean
function-based interface to getting the alignment of a type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43096 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
774577c1f9
commit
87f3870db9
@ -38,6 +38,13 @@ template <typename T>
|
||||
struct AlignOf {
|
||||
enum { Alignment = sizeof(AlignmentCalcImpl<T>) - sizeof(T) };
|
||||
};
|
||||
|
||||
/// alignof - A templated function that returns the mininum alignment of
|
||||
/// of a type. This provides no extra functionality beyond the AlignOf
|
||||
/// class besides some cosmetic cleanliness. Example usage:
|
||||
/// alignof<int>() returns the alignment of an int.
|
||||
template <typename T>
|
||||
static inline unsigned alignof() { return AlignOf<T>::Alignment; }
|
||||
|
||||
} // end namespace llvm
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user