Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packed unaligned_type #989

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/etl/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,14 @@ SOFTWARE.
#define ETL_HAS_INITIALIZER_LIST 0
#endif

//*************************************
// Determine if the ETL should use __attribute__((packed).
#if defined(ETL_COMPILER_CLANG) || defined(ETL_COMPILER_GCC) || defined(ETL_COMPILER_INTEL)
#define ETL_PACKED __attribute__((packed))
#else
#define ETL_PACKED
#endif

//*************************************
// Check for availability of certain builtins
#include "profiles/determine_builtin_support.h"
Expand Down
2 changes: 1 addition & 1 deletion include/etl/unaligned_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ namespace etl
///\tparam Endian The endianness of the arithmetic type.
//*************************************************************************
template <typename T, int Endian_>
class unaligned_type : public private_unaligned_type::unaligned_type_common<sizeof(T)>
class ETL_PACKED unaligned_type : public private_unaligned_type::unaligned_type_common<sizeof(T)>
{
public:

Expand Down
Loading