mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
Merge pull request #165 from cmazakas/fix/msvc-rtc
Add msvc RTC to select test targets
This commit is contained in:
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@ -217,11 +217,13 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- { toolset: msvc-14.0, cxxstd: '14,latest', addrmd: '32,64', os: windows-2019 }
|
- { toolset: msvc-14.0, cxxstd: '14,latest', addrmd: '32,64', os: windows-2019, variant: 'debug,release' }
|
||||||
- { toolset: msvc-14.2, cxxstd: '14,17,20,latest', addrmd: '32,64', os: windows-2019 }
|
- { toolset: msvc-14.2, cxxstd: '14,17,20,latest', addrmd: '32,64', os: windows-2019, variant: 'debug,release' }
|
||||||
- { toolset: msvc-14.3, cxxstd: '14,17,20,latest', addrmd: '32,64', os: windows-2022 }
|
- { toolset: msvc-14.3, cxxstd: '14,17,20,latest', addrmd: '32,64', os: windows-2022, variant: 'debug,release' }
|
||||||
- { toolset: clang-win, cxxstd: '14,17,latest', addrmd: '32,64', os: windows-2022 }
|
- { toolset: msvc-14.3, cxxstd: '14', addrmd: '64', os: windows-2022, variant: 'debug', defines: '_ALLOW_RTCc_IN_STL', cxxflags: '/RTCc' }
|
||||||
- { toolset: gcc, cxxstd: '03,11,14,17,2a', addrmd: '64', os: windows-2019 }
|
- { toolset: msvc-14.3, cxxstd: '14', addrmd: '32', os: windows-2022, variant: 'debug', defines: '_ALLOW_RTCc_IN_STL', cxxflags: '"/RTCc /arch:IA32"' }
|
||||||
|
- { toolset: clang-win, cxxstd: '14,17,latest', addrmd: '32,64', os: windows-2022, variant: 'debug,release' }
|
||||||
|
- { toolset: gcc, cxxstd: '03,11,14,17,2a', addrmd: '64', os: windows-2019, variant: 'debug,release' }
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
@ -250,6 +252,9 @@ jobs:
|
|||||||
B2_TOOLSET: ${{matrix.toolset}}
|
B2_TOOLSET: ${{matrix.toolset}}
|
||||||
B2_CXXSTD: ${{matrix.cxxstd}}
|
B2_CXXSTD: ${{matrix.cxxstd}}
|
||||||
B2_ADDRESS_MODEL: ${{matrix.addrmd}}
|
B2_ADDRESS_MODEL: ${{matrix.addrmd}}
|
||||||
|
B2_DEFINES: ${{matrix.defines}}
|
||||||
|
B2_VARIANT: ${{matrix.variant}}
|
||||||
|
B2_CXXFLAGS: ${{matrix.cxxflags}}
|
||||||
|
|
||||||
- name: Collect coverage
|
- name: Collect coverage
|
||||||
shell: powershell
|
shell: powershell
|
||||||
|
@ -261,12 +261,20 @@ private:
|
|||||||
0xF8F8F8F8u,0xF9F9F9F9u,0xFAFAFAFAu,0xFBFBFBFBu,0xFCFCFCFCu,0xFDFDFDFDu,0xFEFEFEFEu,0xFFFFFFFFu,
|
0xF8F8F8F8u,0xF9F9F9F9u,0xFAFAFAFAu,0xFBFBFBFBu,0xFCFCFCFCu,0xFDFDFDFDu,0xFEFEFEFEu,0xFFFFFFFFu,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(__MSVC_RUNTIME_CHECKS)
|
||||||
|
return (int)word[hash&0xffu];
|
||||||
|
#else
|
||||||
return (int)word[(unsigned char)hash];
|
return (int)word[(unsigned char)hash];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static unsigned char reduced_hash(std::size_t hash)
|
inline static unsigned char reduced_hash(std::size_t hash)
|
||||||
{
|
{
|
||||||
|
#if defined(__MSVC_RUNTIME_CHECKS)
|
||||||
|
return match_word(hash)&0xffu;
|
||||||
|
#else
|
||||||
return (unsigned char)match_word(hash);
|
return (unsigned char)match_word(hash);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char& at(std::size_t pos)
|
inline unsigned char& at(std::size_t pos)
|
||||||
@ -517,7 +525,11 @@ struct group15
|
|||||||
std::size_t pos=reinterpret_cast<uintptr_t>(pc)%sizeof(group15);
|
std::size_t pos=reinterpret_cast<uintptr_t>(pc)%sizeof(group15);
|
||||||
group15 *pg=reinterpret_cast<group15*>(pc-pos);
|
group15 *pg=reinterpret_cast<group15*>(pc-pos);
|
||||||
boost::uint64_t x=((pg->m[0])>>pos)&0x000100010001ull;
|
boost::uint64_t x=((pg->m[0])>>pos)&0x000100010001ull;
|
||||||
|
#if defined(__MSVC_RUNTIME_CHECKS)
|
||||||
|
boost::uint32_t y=(x|(x>>15)|(x>>30))&0xffffffffu;
|
||||||
|
#else
|
||||||
boost::uint32_t y=static_cast<boost::uint32_t>(x|(x>>15)|(x>>30));
|
boost::uint32_t y=static_cast<boost::uint32_t>(x|(x>>15)|(x>>30));
|
||||||
|
#endif
|
||||||
return !pg->is_not_overflowed(y);
|
return !pg->is_not_overflowed(y);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -532,7 +544,11 @@ struct group15
|
|||||||
inline int match_occupied()const
|
inline int match_occupied()const
|
||||||
{
|
{
|
||||||
boost::uint64_t x=m[0]|m[1];
|
boost::uint64_t x=m[0]|m[1];
|
||||||
|
#if defined(__MSVC_RUNTIME_CHECKS)
|
||||||
|
boost::uint32_t y=(x|(x>>32))&0xffffffffu;
|
||||||
|
#else
|
||||||
boost::uint32_t y=static_cast<boost::uint32_t>(x|(x>>32));
|
boost::uint32_t y=static_cast<boost::uint32_t>(x|(x>>32));
|
||||||
|
#endif
|
||||||
y|=y>>16;
|
y|=y>>16;
|
||||||
return y&0x7FFF;
|
return y&0x7FFF;
|
||||||
}
|
}
|
||||||
@ -567,7 +583,11 @@ private:
|
|||||||
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
|
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(__MSVC_RUNTIME_CHECKS)
|
||||||
|
return table[hash&0xffu];
|
||||||
|
#else
|
||||||
return table[(unsigned char)hash];
|
return table[(unsigned char)hash];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void set_impl(std::size_t pos,std::size_t n)
|
inline void set_impl(std::size_t pos,std::size_t n)
|
||||||
@ -994,6 +1014,7 @@ void swap_if(T&,T&){}
|
|||||||
|
|
||||||
inline void prefetch(const void* p)
|
inline void prefetch(const void* p)
|
||||||
{
|
{
|
||||||
|
(void) p;
|
||||||
#if defined(BOOST_GCC)||defined(BOOST_CLANG)
|
#if defined(BOOST_GCC)||defined(BOOST_CLANG)
|
||||||
__builtin_prefetch((const char*)p);
|
__builtin_prefetch((const char*)p);
|
||||||
#elif defined(BOOST_UNORDERED_SSE2)
|
#elif defined(BOOST_UNORDERED_SSE2)
|
||||||
|
@ -117,9 +117,15 @@ namespace boost {
|
|||||||
#if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
|
#if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
|
||||||
std::size_t sizes_under_32bit = inv_sizes32_len;
|
std::size_t sizes_under_32bit = inv_sizes32_len;
|
||||||
if (BOOST_LIKELY(size_index < sizes_under_32bit)) {
|
if (BOOST_LIKELY(size_index < sizes_under_32bit)) {
|
||||||
|
#if defined(__MSVC_RUNTIME_CHECKS)
|
||||||
|
return fast_modulo(
|
||||||
|
boost::uint32_t(hash & 0xffffffffu) + boost::uint32_t(hash >> 32),
|
||||||
|
inv_sizes32[size_index], boost::uint32_t(sizes[size_index]));
|
||||||
|
#else
|
||||||
return fast_modulo(
|
return fast_modulo(
|
||||||
boost::uint32_t(hash) + boost::uint32_t(hash >> 32),
|
boost::uint32_t(hash) + boost::uint32_t(hash >> 32),
|
||||||
inv_sizes32[size_index], boost::uint32_t(sizes[size_index]));
|
inv_sizes32[size_index], boost::uint32_t(sizes[size_index]));
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return positions[size_index - sizes_under_32bit](hash);
|
return positions[size_index - sizes_under_32bit](hash);
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ void macros_test()
|
|||||||
BOOST_ERROR("std::numeric_limits<size_t>::digits >= 64, but "
|
BOOST_ERROR("std::numeric_limits<size_t>::digits >= 64, but "
|
||||||
"BOOST_UNORDERED_FCA_HAS_64B_SIZE_T is not defined");
|
"BOOST_UNORDERED_FCA_HAS_64B_SIZE_T is not defined");
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
#if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
|
#if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
|
||||||
BOOST_ERROR("std::numeric_limits<size_t>::digits < 64, but "
|
BOOST_ERROR("std::numeric_limits<size_t>::digits < 64, but "
|
||||||
"BOOST_UNORDERED_FCA_HAS_64B_SIZE_T is defined");
|
"BOOST_UNORDERED_FCA_HAS_64B_SIZE_T is defined");
|
||||||
@ -155,7 +154,7 @@ void get_remainder_test()
|
|||||||
|
|
||||||
for (std::size_t i = 0; i < 1000000u; ++i) {
|
for (std::size_t i = 0; i < 1000000u; ++i) {
|
||||||
boost::uint64_t f = rng();
|
boost::uint64_t f = rng();
|
||||||
boost::uint32_t d = static_cast<uint32_t>(rng());
|
boost::uint32_t d = rng() & 0xffffffffu;
|
||||||
|
|
||||||
boost::uint64_t r1 =
|
boost::uint64_t r1 =
|
||||||
boost::unordered::detail::prime_fmod_size<>::get_remainder(f, d);
|
boost::unordered::detail::prime_fmod_size<>::get_remainder(f, d);
|
||||||
@ -180,14 +179,14 @@ void modulo_test()
|
|||||||
boost::detail::splitmix64 rng;
|
boost::detail::splitmix64 rng;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < 1000000u; ++i) {
|
for (std::size_t i = 0; i < 1000000u; ++i) {
|
||||||
std::size_t hash = static_cast<std::size_t>(rng());
|
std::size_t hash = static_cast<std::size_t>(-1) & rng();
|
||||||
|
|
||||||
for (std::size_t j = 0; j < sizes_len; ++j) {
|
for (std::size_t j = 0; j < sizes_len; ++j) {
|
||||||
std::size_t h = hash;
|
std::size_t h = hash;
|
||||||
|
|
||||||
#if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
|
#if defined(BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
|
||||||
if (sizes[j] <= UINT_MAX) {
|
if (sizes[j] <= UINT_MAX) {
|
||||||
h = boost::uint32_t(h) + boost::uint32_t(h >> 32);
|
h = boost::uint32_t(h & 0xffffffffu) + boost::uint32_t(h >> 32);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
std::size_t p1 =
|
std::size_t p1 =
|
||||||
|
Reference in New Issue
Block a user