boostorg / boostorg/crc

Testfailures if boost::uint_t<XX>::fast isn't the same as boost::uint_t<XX>::least

Open
#12 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21
Forks
51
PR merge metrics
No merged PRs in 30d

Description

I don't know what the exact reason is, but if you apply the following patch to Boost.Integer, crc_test and crc_test2 fail:

--- include/boost/integer.hpp
+++ include/boost/integer.hpp
@@ -48,6 +48,13 @@ namespace boost
typedef fast type;
}; // imps may specialize

+ template<>
+ struct int_fast_t
+ {
+ typedef unsigned int fast;
+ typedef unsigned int type;
+ };
+
namespace detail{

// convert category to type

Best I can tell, this is the correct way to tell boost that it is faster to perform operations on ints than on shorts on a particular platform, even if you only need 16 bit.

Background: I was trying to convert Boost.CRC int a standalone version without any boost dependencies using the `std::uint_fast_XX_t / _least_XX_t` type alieases instead of the `boost::uint_t::fast/least` ones.
At least on msvc x64, `std::uint_fast16_t` is `unsigned int`, not `unsigned short`. After some investigation I could reproduce this even without touching boost crc but only changing `boost::uint_t<16>` in Boost.Integer as above.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.