some attempts for structure packing under GNU C++
This commit is contained in:
parent
84cc6b4d35
commit
5667fae364
24
fourindex.h
24
fourindex.h
@ -74,15 +74,28 @@ return (i/hcd0(i,j)*j);
|
|||||||
//when patient enough, make const_casts for piterators to have pbegin() const
|
//when patient enough, make const_casts for piterators to have pbegin() const
|
||||||
|
|
||||||
template<class I>
|
template<class I>
|
||||||
union packed_index {
|
struct indiv_index {
|
||||||
I packed[4];
|
|
||||||
struct {
|
|
||||||
I i;
|
I i;
|
||||||
I j;
|
I j;
|
||||||
I k;
|
I k;
|
||||||
I l;
|
I l;
|
||||||
} indiv;
|
}
|
||||||
};
|
#ifdef __GNUC__
|
||||||
|
__attribute__((packed))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class I>
|
||||||
|
union packed_index {
|
||||||
|
I packed[4];
|
||||||
|
struct indiv_index<I> indiv;
|
||||||
|
}
|
||||||
|
#ifdef __GNUC__
|
||||||
|
__attribute__((packed))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
template<class I, class T>
|
template<class I, class T>
|
||||||
struct matel4
|
struct matel4
|
||||||
@ -91,6 +104,7 @@ struct matel4
|
|||||||
matel4 *next;
|
matel4 *next;
|
||||||
union packed_index<I> index;
|
union packed_index<I> index;
|
||||||
};
|
};
|
||||||
|
//should not be packed
|
||||||
|
|
||||||
|
|
||||||
template<class I, class T>
|
template<class I, class T>
|
||||||
|
Loading…
Reference in New Issue
Block a user