Fix integer types in deflate_stream::bi_reverse

This commit is contained in:
Vinnie Falco
2017-06-22 08:56:46 -07:00
parent 246f55321c
commit b5c69ff7c7
2 changed files with 10 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
Version 65:
* Enable narrowing warning on msvc cmake
* Fix integer types in deflate_stream::bi_reverse
--------------------------------------------------------------------------------

View File

@@ -646,9 +646,10 @@ protected:
init();
}
template<class Unsigned>
static
unsigned
bi_reverse(unsigned code, int len);
Unsigned
bi_reverse(Unsigned code, unsigned len);
template<class = void>
static
@@ -742,12 +743,15 @@ protected:
//--------------------------------------------------------------------------
// Reverse the first len bits of a code
template<class Unsigned>
inline
unsigned
Unsigned
deflate_stream::
bi_reverse(unsigned code, int len)
bi_reverse(Unsigned code, unsigned len)
{
unsigned res = 0;
BOOST_STATIC_ASSERT(std::is_unsigned<Unsigned>::value);
BOOST_ASSERT(len <= 8 * sizeof(unsigned));
Unsigned res = 0;
do
{
res |= code & 1;