Boost logo

Boost :

Subject: Re: [boost] [integer] Promotion of endian library code from vault
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-09-27 03:51:54


----- Original Message -----
From: "Beman Dawes" <bdawes_at_[hidden]>
To: <boost_at_[hidden]>
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;
    };
 


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk