vicente.botet | 27 Sep 09:51
Picon

Re: [integer] Promotion of endian library code from vault

----- Original Message ----- 
From: "Beman Dawes" <bdawes <at> acm.org>
To: <boost <at> lists.boost.org>
Sent: Friday, May 30, 2008 2:04 PM
Subject: Re: [boost] [integer] Promotion of endian library code from vault

> I really should put it into the subversion sandbox. I'll try to do that 
> later today.

Hi Beman, 
there is a copy/paste bug on the sandbox.

#     ifdef BOOST_BIG_ENDIAN            // BUG !!!!!!!!!!

must be 

#     ifdef BOOST_LITTLE_ENDIAN

isn't it?

Vicente

    template <typename T, std::size_t n_bits>
    class endian< endianness::little, T, n_bits, alignment::aligned  >
      : cover_operators< endian< endianness::little, T, n_bits, 
alignment::aligned >, T >
    {
        BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
        BOOST_STATIC_ASSERT( sizeof(T) == n_bits/8 );
      public:
        typedef T value_type;
#   ifndef BOOST_ENDIAN_NO_CTORS
        endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
#     ifdef BOOST_BIG_ENDIAN            // BUG !!!!!!!!!!
        endian(T val) : m_value(val) { }
#     else
        explicit endian(T val)    { detail::store_little_endian<T, 
sizeof(T)>(&m_value, val); }
#     endif
#   endif
#   ifdef BOOST_LITTLE_ENDIAN
        endian & operator=(T val) { m_value = val; return *this; }
        operator T() const        { return m_value; }
    #else
        endian & operator=(T val) { detail::store_little_endian<T, 
sizeof(T)>(&m_value, val); return *this; }
        operator T() const        { return detail::load_little_endian<T, 
sizeof(T)>(&m_value); }
    #endif
      private:
       T m_value;
    };

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Gmane