Quantcast

[crc] Current status of this library

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[crc] Current status of this library

Boost - Users mailing list
Hi all,

I have a compile error using the Boost 1.63.0 CRC library with the g++
v6.3 compiler with the following usage:

#include <boost/crc.hpp>

extern "C"
{
    short crc12 (unsigned char const * data, int length);
    bool crc12_check (unsigned char const * data, int length);
}

// assumes CRC is last 16 bits of the data and is set to zero
// caller should assign the returned CRC into the message in big endian byte order
short crc12 (unsigned char const * data, int length)
{
     return boost::augmented_crc<12, 0xc06> (data, length);
}

bool crc12_check (unsigned char const * data, int length)
{
    return !boost::augmented_crc<12, 0xc06> (data, length);
}

The error I get with g++ v6.3 is:

In file included from /home/bill/wsjtx-prefix/src/boost/boost/config.hpp:61:0,
                  from /home/bill/wsjtx-prefix/src/boost/boost/crc.hpp:12,
                  from /home/bill/wsjtx-prefix/src/lib/crc12.cpp:1:
/home/bill/wsjtx-prefix/src/boost/boost/crc.hpp: In instantiation of ‘const least boost::detail::mask_uint_t<12ul>::sig_bits’:
/home/bill/wsjtx-prefix/src/boost/boost/crc.hpp:356:9:   required from ‘const fast boost::detail::mask_uint_t<12ul>::sig_bits_fast’
/home/bill/wsjtx-prefix/src/boost/boost/crc.hpp:1075:16:   required from ‘typename boost::uint_t<Bits>::fast boost::augmented_crc(const void*, std::size_t, typename boost::uint_t<Bits>::fast) [with long unsigned int Bits = 12ul; typename boost::uint_t<Bits>::fast TruncPoly = 3078u; typename boost::uint_t<Bits>::fast = short unsigned int; std::size_t = long unsigned int]’
/home/bill/wsjtx-prefix/src/boost/boost/crc.hpp:1092:41:   required from ‘typename boost::uint_t<Bits>::fast boost::augmented_crc(const void*, std::size_t) [with long unsigned int Bits = 12ul; typename boost::uint_t<Bits>::fast TruncPoly = 3078u; typename boost::uint_t<Bits>::fast = short unsigned int; std::size_t = long unsigned int]’
/home/bill/wsjtx-prefix/src/lib/crc12.cpp:14:57:   required from here
/home/bill/wsjtx-prefix/src/boost/boost/crc.hpp:350:69: warning: left shift of negative value [-Wshift-negative-value]
          BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) );
                                                     ~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/bill/wsjtx-prefix/src/boost/boost/crc.hpp:350:69: error: left operand of shift expression ‘(-1 << 12ul)’ is negative [-fpermissive]

I note that the develop branch of the CRC library has many changes since
Boost 1.63.0 but none are in Boost 1.64.0-beta1. So far I have only
tried the new library (devlop branch) with my code and it compiles ok
but I need to test it further.

Does anyone know why the latest CRC library is not in 1.64 and also does
anyone know if the develop branch code is ok and usable by substitution
into a 1.63 Boost?

Regards
Bill Somerville.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Loading...