From 5667fae36433968bea4f6fe79ccce8cd4674ad96 Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Sat, 28 Aug 2021 17:05:54 +0200 Subject: [PATCH] some attempts for structure packing under GNU C++ --- fourindex.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/fourindex.h b/fourindex.h index 3ab4d75..84f48c8 100644 --- a/fourindex.h +++ b/fourindex.h @@ -74,15 +74,28 @@ return (i/hcd0(i,j)*j); //when patient enough, make const_casts for piterators to have pbegin() const template -union packed_index { - I packed[4]; - struct { + struct indiv_index { I i; I j; I k; I l; - } indiv; - }; + } +#ifdef __GNUC__ +__attribute__((packed)) +#endif +; + + + +template +union packed_index { + I packed[4]; + struct indiv_index indiv; + } +#ifdef __GNUC__ +__attribute__((packed)) +#endif +; template struct matel4 @@ -91,6 +104,7 @@ struct matel4 matel4 *next; union packed_index index; }; +//should not be packed template