|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2007-10-11 04:26:47
Andreas Brinck wrote:
> (Sorry for sending this twice, I didn't format the subject the
> correct way first time)
No problem, I saw the first message, just haven't gotten around to it yet
:-(
> I'm using Visual Studio 2005 and got into trouble when I tried to
> serialize
> a class with 16 byte alignment:
>
> __declspec(align(16)) class Vech
> {
> ...
> __m128 m_data;
> };
>
> The problem is that the following static assert in
> type_with_alignment is triggered:
>
> BOOST_STATIC_ASSERT(found % Align == 0);
>
> which in turn stems from the fact that sizeof(max_align) == 8. By
> changing the lines:
>
> #define BOOST_TT_ALIGNMENT_BASE_TYPES BOOST_PP_TUPLE_TO_LIST( \
> 12, ( \
> char, short, int, long, ::boost::long_long_type, float,
> double,
> long double \
> , void*, function_ptr, member_ptr, member_function_ptr))
>
> to
>
> #include <xmmintrin.h>
>
> #define BOOST_TT_ALIGNMENT_BASE_TYPES BOOST_PP_TUPLE_TO_LIST( \
> 13, ( \
> char, short, int, long, ::boost::long_long_type, float,
> double,
> long double \
> , void*, function_ptr, member_ptr, member_function_ptr,
> __m128))
>
> I got rid of the static assert and everything seems to work just
> fine. Would it be possible to get this "fix" into a later release of
> boost in a more rigorous and organized fashion (with all the
> surrounding compiler
> workarounds and typedefs etc.)?
>
> Or is there another way to get the same effect?
I think I'd prefer a solution that didn't involve including xmmintrin.h: do
you know if that header is universally available for VC8? Either way, will
you please open a Trac bug report on this (at svn.boost.org), so this
doesn't get lost? I don't want to patch type_traits in the run up to the
1.35 release, but once the "core" libraries have been merged to the release
branch, I will look into this.
Thanks for the report, John Maddock.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk