mn_alignment.hpp File Reference
#include <stddef.h>
#include <stdint.h>
#include <stdalign.h>
#include "mn_nlz.hpp"
#include "../mn_typetraits.hpp"
#include "../mn_def.hpp"

Go to the source code of this file.

Classes

struct  mn::internal::alignof_helper< T >
 
struct  mn::internal::type_with_alignment< N >
 
struct  mn::internal::type_with_alignment< 1 >
 
struct  mn::internal::type_with_alignment< 2 >
 
struct  mn::internal::type_with_alignment< 4 >
 
struct  mn::internal::type_with_alignment< 8 >
 
struct  mn::internal::type_with_alignment< 16 >
 
struct  mn::internal::type_with_alignment< 32 >
 
struct  mn::internal::type_with_alignment< 64 >
 
union  mn::internal::max_align
 
struct  mn::is_pod< internal::aligned1 >
 
struct  mn::is_pod< internal::aligned2 >
 
struct  mn::is_pod< internal::aligned4 >
 
struct  mn::is_pod< internal::aligned8 >
 
struct  mn::is_pod< internal::aligned16 >
 
struct  mn::is_pod< internal::aligned32 >
 
struct  mn::is_pod< internal::aligned64 >
 
struct  mn::alignment_of< T >
 
struct  mn::alignment_of< void >
 
struct  mn::alignment_of< void const >
 
struct  mn::alignment_of< void const volatile >
 
struct  mn::alignment_of< void volatile >
 
struct  mn::long_double_alignment< Target, check >
 
struct  mn::long_double_alignment< Target, false >
 
struct  mn::double_alignment< Target, check >
 
struct  mn::double_alignment< Target, false >
 
struct  mn::long_long_alignment< Target, check >
 
struct  mn::long_long_alignment< Target, false >
 
struct  mn::long_alignment< Target, check >
 
struct  mn::long_alignment< Target, false >
 
struct  mn::int_alignment< Target, check >
 
struct  mn::int_alignment< Target, false >
 
struct  mn::short_alignment< Target, check >
 
struct  mn::short_alignment< Target, false >
 
struct  mn::char_alignment< Target, check >
 
struct  mn::char_alignment< Target, false >
 
struct  mn::aligned_as< T >
 

Namespaces

 mn
 
 mn::internal
 

Functions

struct mn::internal::__attribute__ ((aligned(1))) aligned1
 
struct mn::internal::__attribute__ ((aligned(2))) aligned2
 
struct mn::internal::__attribute__ ((aligned(4))) aligned4
 
struct mn::internal::__attribute__ ((aligned(8))) aligned8
 
struct mn::internal::__attribute__ ((aligned(16))) aligned16
 
struct mn::internal::__attribute__ ((aligned(32))) aligned32
 
struct mn::internal::__attribute__ ((aligned(64))) aligned64
 
template<class integral >
constexpr bool mn::is_aligned (integral x, size_t a) noexcept
 
bool mn::is_aligned (const volatile void *p, size_t a)
 
template<class integral >
constexpr integral mn::align_up (integral x, size_t a) noexcept
 
template<class pointer >
pointer mn::align_up_ptr (pointer p, size_t a)
 
template<class integral >
constexpr integral mn::align_down (integral x, size_t a) noexcept
 
template<class pointer >
pointer mn::align_down_ptr (pointer p, size_t a)
 
constexpr bool mn::is_aligvalid (size_t alignment) noexcept
 is a valid alignment, i.e. a power of two not zero More...
 
size_t mn::alig_offset (void *address, size_t alignment) noexcept
 
size_t mn::alignment_for (const size_t size) noexcept
 

Class Documentation

◆ mn::internal::alignof_helper

struct mn::internal::alignof_helper

template<typename T>
struct mn::internal::alignof_helper< T >

Class Members
char x
T y

◆ mn::internal::type_with_alignment

struct mn::internal::type_with_alignment

template<size_t N>
struct mn::internal::type_with_alignment< N >

Class Members
typedef char err_invalid_alignment

◆ mn::internal::type_with_alignment< 1 >

struct mn::internal::type_with_alignment< 1 >
Class Members
aligned1 type

◆ mn::internal::type_with_alignment< 2 >

struct mn::internal::type_with_alignment< 2 >
Class Members
aligned2 type

◆ mn::internal::type_with_alignment< 4 >

struct mn::internal::type_with_alignment< 4 >
Class Members
aligned4 type

◆ mn::internal::type_with_alignment< 8 >

struct mn::internal::type_with_alignment< 8 >
Class Members
aligned8 type

◆ mn::internal::type_with_alignment< 16 >

struct mn::internal::type_with_alignment< 16 >
Class Members
aligned16 type

◆ mn::internal::type_with_alignment< 32 >

struct mn::internal::type_with_alignment< 32 >
Class Members
aligned32 type

◆ mn::internal::type_with_alignment< 64 >

struct mn::internal::type_with_alignment< 64 >
Class Members
aligned64 type

◆ mn::internal::max_align

union mn::internal::max_align
Class Members
char c
double d
float f
int i
long l
long long ll
short s

◆ mn::long_double_alignment

struct mn::long_double_alignment

template<size_t Target, bool check>
struct mn::long_double_alignment< Target, check >

Class Members
typedef long double type

◆ mn::long_double_alignment< Target, false >

struct mn::long_double_alignment< Target, false >

template<size_t Target>
struct mn::long_double_alignment< Target, false >

Class Members
typedef max_align type

◆ mn::double_alignment

struct mn::double_alignment

template<size_t Target, bool check>
struct mn::double_alignment< Target, check >

Class Members
typedef double type

◆ mn::double_alignment< Target, false >

struct mn::double_alignment< Target, false >

template<size_t Target>
struct mn::double_alignment< Target, false >

Class Members
typedef typename long_double_alignment< Target, alignment_of< long double >::res >=Target >::type type

◆ mn::long_long_alignment

struct mn::long_long_alignment

template<size_t Target, bool check>
struct mn::long_long_alignment< Target, check >

Class Members
typedef long long type

◆ mn::long_long_alignment< Target, false >

struct mn::long_long_alignment< Target, false >

template<size_t Target>
struct mn::long_long_alignment< Target, false >

Class Members
typedef typename double_alignment< Target, alignment_of< double >::res >=Target >::type type

◆ mn::long_alignment

struct mn::long_alignment

template<size_t Target, bool check>
struct mn::long_alignment< Target, check >

Class Members
typedef long type

◆ mn::long_alignment< Target, false >

struct mn::long_alignment< Target, false >

template<size_t Target>
struct mn::long_alignment< Target, false >

Class Members
typedef typename long_long_alignment< Target, alignment_of< long long >::res >=Target >::type type

◆ mn::int_alignment

struct mn::int_alignment

template<size_t Target, bool check>
struct mn::int_alignment< Target, check >

Class Members
typedef int type

◆ mn::int_alignment< Target, false >

struct mn::int_alignment< Target, false >

template<size_t Target>
struct mn::int_alignment< Target, false >

Class Members
typedef typename long_alignment< Target, alignment_of< long >::res >=Target >::type type

◆ mn::short_alignment

struct mn::short_alignment

template<size_t Target, bool check>
struct mn::short_alignment< Target, check >

Class Members
typedef short type

◆ mn::short_alignment< Target, false >

struct mn::short_alignment< Target, false >

template<size_t Target>
struct mn::short_alignment< Target, false >

Class Members
typedef typename int_alignment< Target, alignment_of< int >::res >=Target >::type type

◆ mn::char_alignment

struct mn::char_alignment

template<size_t Target, bool check>
struct mn::char_alignment< Target, check >

Class Members
typedef char type

◆ mn::char_alignment< Target, false >

struct mn::char_alignment< Target, false >

template<size_t Target>
struct mn::char_alignment< Target, false >

Class Members
typedef typename short_alignment< Target, alignment_of< short >::res >=Target >::type type

◆ mn::aligned_as

struct mn::aligned_as

template<typename T>
struct mn::aligned_as< T >

Class Members
typedef typename type_with_alignment< alignment_of< T >::res > res