From 63fdfc94a0e5e6a733825f32ada3fd56738b26f2 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Thu, 6 Aug 2020 19:28:47 -0700 Subject: [PATCH 01/13] Fixes incorrect rounding in rejection method. - Should be based on floor(val) but implemented as trunction, so -1 < val < 0 is mistakenly accepted. The result 0 is therefore overrepresented. --- stl/inc/random | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index f3748cb2fb..d7e1fba0ac 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2291,8 +2291,9 @@ private: _Ty1 _Yx; for (;;) { // generate a tentative value _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); - _Res = static_cast<_Ty>(_Par0._Sqrt * _Yx + _Par0._Mean); - if (_Ty{0} <= _Res) { + const _Ty1 _Mx{_Par0._Sqrt * _Yx + _Par0._Mean}; + if (0.0 <= _Mx) { + _Res = static_cast<_Ty>(_Mx); break; } } @@ -2473,8 +2474,9 @@ private: _Ty1 _Yx; for (;;) { // generate a tentative value _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); - _Res = static_cast<_Ty>(_Par0._Sqrt * _Yx + _Par0._Mean); - if (_Ty{0} <= _Res && _Res <= _Par0._Tx) { + const _Ty1 _Mx{_Par0._Sqrt * _Yx + _Par0._Mean}; + if (0.0 <= _Mx && _Mx < _Par0._Tx + _Ty{1}) { + _Res = static_cast<_Ty>(_Mx); break; } } From 4353d4383bee851e790b75050f9c8c75be4357d1 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Thu, 6 Aug 2020 22:01:33 -0700 Subject: [PATCH 02/13] Fix formatting --- stl/inc/random | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index d7e1fba0ac..c66749e3c2 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2290,7 +2290,7 @@ private: _Ty _Res; _Ty1 _Yx; for (;;) { // generate a tentative value - _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); + _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); const _Ty1 _Mx{_Par0._Sqrt * _Yx + _Par0._Mean}; if (0.0 <= _Mx) { _Res = static_cast<_Ty>(_Mx); @@ -2473,7 +2473,7 @@ private: for (;;) { // generate and reject _Ty1 _Yx; for (;;) { // generate a tentative value - _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); + _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); const _Ty1 _Mx{_Par0._Sqrt * _Yx + _Par0._Mean}; if (0.0 <= _Mx && _Mx < _Par0._Tx + _Ty{1}) { _Res = static_cast<_Ty>(_Mx); From 58883edcd3b27807ce641ed658e11991fda3039a Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Fri, 14 Aug 2020 15:05:50 -0700 Subject: [PATCH 03/13] Fix out-of-range casts from double to integer types Most of the work is in a helper function that calculates the largest floating point number that truncates to less than or equal to a given unsigned integer. --- stl/inc/random | 62 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index c66749e3c2..19a9a0adc7 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -7,6 +7,7 @@ #ifndef _RANDOM_ #define _RANDOM_ #include +#include #if _STL_COMPILER_PREPROCESSOR #include #include @@ -2025,6 +2026,44 @@ basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, return _Dist._Write(_Ostr); } +// FUNCTION TEMPLATE _Trunc_to_float + +// - Returns largest _Flt s.t. static_cast<_Ty>(_Result) <= _Val +// - First truncate to largest _Flt <= _Val, then add ceil(ulp)-ulp. If +// ulp > 1, this is a nop, so skip the expensive nextafter call. + +template +_NODISCARD inline _Flt _Trunc_to_float(_Ty _Val) { + constexpr auto _Ty_digits = numeric_limits<_Ty>::digits; + constexpr auto _Flt_digits = numeric_limits<_Flt>::digits; + // workaround for lack of constexpr-if to avoid negative shift warning + constexpr auto _Abs_diff_digits = (_Ty_digits > _Flt_digits) + ? _Ty_digits - _Flt_digits : _Flt_digits - _Ty_digits; + + if _CONSTEXPR_IF (_Ty_digits <= _Flt_digits){ + _Flt _Result = + _Val < numeric_limits<_Ty>::max() + ? static_cast<_Flt>(_Val + _Ty{1}) + : _STD exp2(static_cast<_Flt>(_STD numeric_limits<_Ty>::digits)); + return _STD nextafter(_Result, _Flt{0.0}); + } else { +#pragma warning(push) +#pragma warning(disable : 4146) // unary minus of unsigned + constexpr auto _Mask = _Ty(-1) << _Abs_diff_digits; + const auto _Log = _Floor_of_log_2(_Val); + const auto _Shifted_mask = _Mask >> (_Ty_digits - 1 - _Log); + const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; + _Val &= _Shifted_mask; + if (_Ceil_ulp > _Ty{1}) { + return static_cast<_Flt>(_Val); + } else { + const auto _Result = static_cast<_Flt>(_Val + _Ceil_ulp); + return _STD nextafter(_Result, _Flt{0.0}); + } +#pragma warning(pop) + } +} + // CLASS TEMPLATE geometric_distribution template class geometric_distribution { // geometric distribution @@ -2123,7 +2162,15 @@ public: private: template result_type _Eval(_Engine& _Eng, const param_type& _Par0) const { - return static_cast<_Ty>(_CSTD log(_NRAND(_Eng, _Ty1)) / _Par0._Log_1_p); + using _Uty = make_unsigned_t<_Ty>; + constexpr auto _Ty_max{numeric_limits<_Ty>::max()}; + const auto _Ty1_max{_Trunc_to_float<_Ty1,_Uty>(static_cast<_Uty>(_Ty_max))}; + + _Ty1 _Val; + do{ + _Val = _CSTD log(_NRAND(_Eng, _Ty1)) / _Par0._Log_1_p; + } while (_Val > _Ty1_max); + return static_cast<_Ty>(_Val); } param_type _Par; @@ -2287,12 +2334,16 @@ private: } for (;;) { // generate and reject + using _Uty = make_unsigned_t<_Ty>; + constexpr auto _Ty_max{numeric_limits<_Ty>::max()}; + const auto _Ty1_max{_Trunc_to_float<_Ty1, _Uty>(static_cast<_Uty>(_Ty_max))}; + _Ty _Res; _Ty1 _Yx; for (;;) { // generate a tentative value _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); const _Ty1 _Mx{_Par0._Sqrt * _Yx + _Par0._Mean}; - if (0.0 <= _Mx) { + if (0.0 <= _Mx && _Mx <= _Ty1_max) { _Res = static_cast<_Ty>(_Mx); break; } @@ -2470,12 +2521,15 @@ private: // events are rare, use Poisson distribution _Res = _Par0._Small(_Eng); } else { // no shortcuts + using _Uty = make_unsigned_t<_Ty>; + const auto _Ty1_Tx{_Trunc_to_float<_Ty1, _Uty>(static_cast<_Uty>(_Par0._Tx))}; + for (;;) { // generate and reject _Ty1 _Yx; for (;;) { // generate a tentative value _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); const _Ty1 _Mx{_Par0._Sqrt * _Yx + _Par0._Mean}; - if (0.0 <= _Mx && _Mx < _Par0._Tx + _Ty{1}) { + if (0.0 <= _Mx && _Mx <= _Ty1_Tx) { _Res = static_cast<_Ty>(_Mx); break; } @@ -3124,7 +3178,7 @@ private: return _Par0._Beta * _Par0._Exp(_Eng); } - if ((_Count = static_cast(_Par0._Alpha)) == _Par0._Alpha && _Count < 20) { + if (_Par0._Alpha < 20.0 && (_Count = static_cast(_Par0._Alpha)) == _Par0._Alpha) { // _Alpha is small integer, compute directly _Yx = _NRAND(_Eng, _Ty); while (--_Count) { // adjust result From c575cb9d01f0f4e5bae9ca1705621b2b54a81f08 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Sun, 16 Aug 2020 23:12:13 -0700 Subject: [PATCH 04/13] Tests for #1001 and #1123 --- tests/std/test.lst | 2 + .../env.lst | 4 ++ .../test.cpp | 40 +++++++++++ .../env.lst | 4 ++ .../test.cpp | 69 +++++++++++++++++++ 5 files changed, 119 insertions(+) create mode 100644 tests/std/tests/GH_001001_random_rejection_rounding/env.lst create mode 100644 tests/std/tests/GH_001001_random_rejection_rounding/test.cpp create mode 100644 tests/std/tests/GH_001123_random_cast_out_of_range/env.lst create mode 100644 tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp diff --git a/tests/std/test.lst b/tests/std/test.lst index 70f23e250c..4251f1d775 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -162,8 +162,10 @@ tests\GH_000685_condition_variable_any tests\GH_000690_overaligned_function tests\GH_000890_pow_template tests\GH_000940_missing_valarray_copy +tests\GH_001001_random_rejection_rounding tests\GH_001010_filesystem_error_encoding tests\GH_001017_discrete_distribution_out_of_range +tests\GH_001123_random_cast_out_of_range tests\LWG2597_complex_branch_cut tests\LWG3018_shared_ptr_function tests\P0024R2_parallel_algorithms_adjacent_difference diff --git a/tests/std/tests/GH_001001_random_rejection_rounding/env.lst b/tests/std/tests/GH_001001_random_rejection_rounding/env.lst new file mode 100644 index 0000000000..19f025bd0e --- /dev/null +++ b/tests/std/tests/GH_001001_random_rejection_rounding/env.lst @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +RUNALL_INCLUDE ..\usual_matrix.lst diff --git a/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp b/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp new file mode 100644 index 0000000000..bc5146d1bb --- /dev/null +++ b/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include + +void Test_GH1001() { + constexpr int N{1000}; + constexpr double p{.001238}; + constexpr int seed{12345}; + constexpr int iters{1'000'000}; + std::map count; + + std::mt19937 mt_rand(seed); + + std::binomial_distribution distribution(N, p); + + for (int i = 0; i < iters; i++) { + ++count[distribution(mt_rand)]; + } + + double mean_x{0.0}; + for (auto pair : count) { + mean_x += pair.first * static_cast(pair.second) / iters; + } + const double p0_x{static_cast(count[0]) / iters}; + const double p1_x{static_cast(count[1]) / iters}; + + const double p0{std::pow(1.0-p,static_cast(N))}; + const double p1{1000.0*p*std::pow(1.0-p,static_cast(N-1))}; + const double mean{p * N}; + + assert(mean_x/mean - 1.0 < 0.002); + assert(p0_x / p0 - 1.0 < 0.002); + assert(p1_x / p1 - 1.0 < 0.002); +} + +int main() { + Test_GH1001(); +} \ No newline at end of file diff --git a/tests/std/tests/GH_001123_random_cast_out_of_range/env.lst b/tests/std/tests/GH_001123_random_cast_out_of_range/env.lst new file mode 100644 index 0000000000..19f025bd0e --- /dev/null +++ b/tests/std/tests/GH_001123_random_cast_out_of_range/env.lst @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +RUNALL_INCLUDE ..\usual_matrix.lst diff --git a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp new file mode 100644 index 0000000000..1d3176bbf7 --- /dev/null +++ b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp @@ -0,0 +1,69 @@ +#include +#include +#include +#include +#include + +template +using lim = std::numeric_limits; + +template +void TruncAndCheck(T i, float fmax) { + const float x{std::_Trunc_to_float(i)}; + const float y{std::nextafter(x, lim::infinity())}; + + assert(x < fmax); + assert(static_cast(x) <= i); + assert(y <= fmax); + if (y < fmax) + assert(static_cast(y) > i); +} + +template +void TestTruncExhaustive() { + const float fmax{exp2(static_cast(lim::digits))}; + T i{0}; + do { + TruncAndCheck(i, fmax); + } while (++i != T{0}); +} + +template +constexpr T FillLsb(int n) { + if (n <= 0) + return 0; + T x{T{1} << (n - 1)}; + return (x - 1) ^ x; +} + +template +void TestTruncSelective() { + const float fmax{exp2(static_cast(lim::digits))}; + TruncAndCheck(T{0}, fmax); + TruncAndCheck(T{1}, fmax); + TruncAndCheck(lim::max(), fmax); + + // crossover from ulp < 1 to ulp = 1 + constexpr T a{FillLsb(lim::digits - 1)}; + TruncAndCheck(a - 1, fmax); + TruncAndCheck(a, fmax); + + // crossover from ulp = 1 to ulp > 1 + constexpr T b{FillLsb(lim::digits)}; + TruncAndCheck(b, fmax); + TruncAndCheck(b + 1, fmax); + TruncAndCheck(b + 2, fmax); + + // saturation at the largest representable T + constexpr int diff{lim::digits - lim::digits}; + constexpr T c{FillLsb(lim::digits) << diff}; + TruncAndCheck(c - 1, fmax); + TruncAndCheck(c, fmax); + TruncAndCheck(c + 1, fmax); +} + +int main() { + TestTruncExhaustive(); + TestTruncExhaustive(); + TestTruncSelective(); +} \ No newline at end of file From d70377479eb7f980952c4cb6a023ef40e8a8c7eb Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Mon, 17 Aug 2020 00:09:15 -0700 Subject: [PATCH 05/13] clang-format --- stl/inc/random | 27 +- tests/std/test.lst | 834 +++++++++--------- .../test.cpp | 12 +- .../test.cpp | 6 +- 4 files changed, 439 insertions(+), 440 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index c418cb90a1..f36fda1c5d 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -7,6 +7,7 @@ #ifndef _RANDOM_ #define _RANDOM_ #include + #include #if _STL_COMPILER_PREPROCESSOR #include @@ -2034,25 +2035,23 @@ basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, template _NODISCARD inline _Flt _Trunc_to_float(_Ty _Val) { - constexpr auto _Ty_digits = numeric_limits<_Ty>::digits; + constexpr auto _Ty_digits = numeric_limits<_Ty>::digits; constexpr auto _Flt_digits = numeric_limits<_Flt>::digits; // workaround for lack of constexpr-if to avoid negative shift warning - constexpr auto _Abs_diff_digits = (_Ty_digits > _Flt_digits) - ? _Ty_digits - _Flt_digits : _Flt_digits - _Ty_digits; - - if _CONSTEXPR_IF (_Ty_digits <= _Flt_digits){ - _Flt _Result = - _Val < numeric_limits<_Ty>::max() - ? static_cast<_Flt>(_Val + _Ty{1}) - : _STD exp2(static_cast<_Flt>(_STD numeric_limits<_Ty>::digits)); + constexpr auto _Abs_diff_digits = (_Ty_digits > _Flt_digits) ? _Ty_digits - _Flt_digits : _Flt_digits - _Ty_digits; + + if _CONSTEXPR_IF (_Ty_digits <= _Flt_digits) { + _Flt _Result = _Val < numeric_limits<_Ty>::max() + ? static_cast<_Flt>(_Val + _Ty{1}) + : _STD exp2(static_cast<_Flt>(_STD numeric_limits<_Ty>::digits)); return _STD nextafter(_Result, _Flt{0.0}); } else { #pragma warning(push) #pragma warning(disable : 4146) // unary minus of unsigned - constexpr auto _Mask = _Ty(-1) << _Abs_diff_digits; - const auto _Log = _Floor_of_log_2(_Val); + constexpr auto _Mask = _Ty(-1) << _Abs_diff_digits; + const auto _Log = _Floor_of_log_2(_Val); const auto _Shifted_mask = _Mask >> (_Ty_digits - 1 - _Log); - const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; + const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; _Val &= _Shifted_mask; if (_Ceil_ulp > _Ty{1}) { return static_cast<_Flt>(_Val); @@ -2164,10 +2163,10 @@ private: result_type _Eval(_Engine& _Eng, const param_type& _Par0) const { using _Uty = make_unsigned_t<_Ty>; constexpr auto _Ty_max{numeric_limits<_Ty>::max()}; - const auto _Ty1_max{_Trunc_to_float<_Ty1,_Uty>(static_cast<_Uty>(_Ty_max))}; + const auto _Ty1_max{_Trunc_to_float<_Ty1, _Uty>(static_cast<_Uty>(_Ty_max))}; _Ty1 _Val; - do{ + do { _Val = _CSTD log(_NRAND(_Eng, _Ty1)) / _Par0._Log_1_p; } while (_Val > _Ty1_max); return static_cast<_Ty>(_Val); diff --git a/tests/std/test.lst b/tests/std/test.lst index 7ba5191412..0f2ec2c93a 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -1,417 +1,417 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -tests\Dev08_496675_iostream_int_reading -tests\Dev08_527068_scl_no_exceptions -tests\Dev08_563686_ostream -tests\Dev08_563705_std_malloc_free -tests\Dev08_576265_list_remove -tests\Dev08_584299_search_n -tests\Dev09_012361_vector_swap -tests\Dev09_052961_has_iterator_debugging_0 -tests\Dev09_056375_locale_cleanup -tests\Dev09_098637_stl_function_typeids -tests\Dev09_119637_throwing_string_with_hid0 -tests\Dev09_119644_compiler_option_gz -tests\Dev09_126254_persistent_aux_allocators -tests\Dev09_130060_unique_copy -tests\Dev09_152755_tr1_nested_bind -tests\Dev09_153419_tr1_allocators -tests\Dev09_154033_tr1_predicate_search_n -tests\Dev09_155328_tr1_vector_of_set -tests\Dev09_158181_tr1_unordered_meow_swap -tests\Dev09_158457_tr1_mem_fn_calling_conventions -tests\Dev09_161106_tr1_bind_templated_fxn_call_operator -tests\Dev09_165853_tr1_tuple_swap -tests\Dev09_171205_tr1_assign_pair_to_tuple -tests\Dev09_172497_tr1_mem_fn_const_correctness -tests\Dev09_172505_tr1_bind_reference_wrapper -tests\Dev09_172666_tr1_tuple_odr -tests\Dev09_173612_tr1_regex_leak -tests\Dev09_174589_tr1_function_storing_pmf_called_with_reference_or_pointer -tests\Dev09_175314_tr1_reference_wrapper_assignment -tests\Dev09_175716_tr1_dereferencing_reference_wrapper -tests\Dev09_176467_tr1_make_tuple_from_string_literal -tests\Dev09_176498_tr1_binding_functors_with_non_const_fxn_call_ops -tests\Dev09_181509_tr1_inf_loop_uniform_int_ull -tests\Dev09_182017_tr1_search_n -tests\Dev09_186118_stoullx_corner_cases -tests\Dev09_192736_tr1_prngs_not_copyconstructible -tests\Dev09_195561_tr1_function_const_op -tests\Dev09_196243_tr1_enable_shared_from_this_ops -tests\Dev09_199123_tr1_mem_fun_abstract_classes -tests\Dev10_391723_bind_result_type -tests\Dev10_414242_facet_bug_use_facet_ctype_char -tests\Dev10_441756_function_reference_wrapper -tests\Dev10_445289_make_shared -tests\Dev10_470547_facet_bug_stringstream -tests\Dev10_482830_header_only_string -tests\Dev10_491486_floating_point_hash -tests\Dev10_492345_tr1_function_swap -tests\Dev10_498944_enable_shared_from_this_auto_ptr -tests\Dev10_500860_overloaded_address_of -tests\Dev10_544258_heterogeneous_comparisons -tests\Dev10_555491_complex_linker_errors -tests\Dev10_561430_list_and_tree_leaks -tests\Dev10_562056_tree_leak -tests\Dev10_563443_empty_vector_begin_plus_zero -tests\Dev10_567556_move_from_empty_list -tests\Dev10_579381_vector_grow_to -tests\Dev10_590599_hash_string -tests\Dev10_609053_ctype_char_table_size -tests\Dev10_617014_tuple_tie -tests\Dev10_632876_regex_proxy -tests\Dev10_635436_shared_ptr_reset -tests\Dev10_639436_const_map_at -tests\Dev10_646244_bad_alloc_message -tests\Dev10_646556_construct_tuple_from_const -tests\Dev10_654977_655012_shared_ptr_move -tests\Dev10_661739_tuple_copy_ctors -tests\Dev10_682964_stable_sort_warnings -tests\Dev10_689595_back_inserter_vector_bool -tests\Dev10_709166_checked_and_unchecked_array_iterator -tests\Dev10_709168_marking_iterators_as_checked -tests\Dev10_722102_shared_ptr_nullptr -tests\Dev10_729003_bind_reference_wrapper -tests\Dev10_766948_insert_ambiguity -tests\Dev10_780098_movable_elements -tests\Dev10_783436_rvalue_string_plus -tests\Dev10_809142_copy_n_istream_iterator -tests\Dev10_814245_regex_character_class_crash -tests\Dev10_816787_swap_vector_bool_elements -tests\Dev10_847656_shared_ptr_is_convertible -tests\Dev10_851347_weak_ptr_virtual_inheritance -tests\Dev10_860410_bitset_ctors -tests\Dev10_860421_deque_push_back_pop_front -tests\Dev10_881629_vector_erase_return_value -tests\Dev10_904413_moved_from_function_should_be_empty -tests\Dev10_905461_is_sorted_until -tests\Dev10_908702_string_memory_leak -tests\Dev10_909646_stringstream_vd2 -tests\Dev11_0000000_dual_range_algorithms -tests\Dev11_0000000_function_crashes -tests\Dev11_0000000_include_each_header_alone -tests\Dev11_0000000_null_forward_iterators -tests\Dev11_0000000_quoted -tests\Dev11_0000000_rotate_test -tests\Dev11_0000000_tuple_cat -tests\Dev11_0000000_user_defined_literals -tests\Dev11_0019127_singular_iterators -tests\Dev11_0091392_string_erase_resize_perf -tests\Dev11_0133625_locale0_implib_cpp -tests\Dev11_0135139_vector_bool_equality_perf -tests\Dev11_0235721_async_and_packaged_task -tests\Dev11_0253803_debug_pointer -tests\Dev11_0272959_make_signed -tests\Dev11_0289403_partition_point_complexity -tests\Dev11_0299014_exception_ptr_requirements -tests\Dev11_0302476_pair_move -tests\Dev11_0314451_make_pair_make_tuple -tests\Dev11_0316853_find_memchr_optimization -tests\Dev11_0343056_pair_tuple_ctor_sfinae -tests\Dev11_0376122_grand_theft_bind -tests\Dev11_0377755_thread_ctor_move_only_types -tests\Dev11_0387701_container_equality -tests\Dev11_0417110_nullptr_t_is_scalar -tests\Dev11_0435439_call_once_deadlock -tests\Dev11_0437519_container_behavior -tests\Dev11_0437519_container_requirements -tests\Dev11_0447546_facet_allocation -tests\Dev11_0453373_codecvt_compiles -tests\Dev11_0483851_vector_debug_allocator_use -tests\Dev11_0485243_condition_variable_crash -tests\Dev11_0493504_error_category_lifetime -tests\Dev11_0494593_time_put_wchar_t -tests\Dev11_0496153_locale_ctor -tests\Dev11_0532622_minmax_element -tests\Dev11_0535636_functional_overhaul -tests\Dev11_0555154_system_clock_to_time_t -tests\Dev11_0577418_random_seed_0 -tests\Dev11_0579795_inplace_merge_out_of_memory -tests\Dev11_0607540_pair_tuple_rvalue_references -tests\Dev11_0617384_empty_std_function -tests\Dev11_0653897_codecvt_partial -tests\Dev11_0671816_list_splice -tests\Dev11_0696045_future_wait_for -tests\Dev11_0704582_ratio -tests\Dev11_0732166_unordered_strong_guarantee -tests\Dev11_0748972_function_crash_out_of_memory -tests\Dev11_0823534_transparent_lookup -tests\Dev11_0835323_to_string -tests\Dev11_0836436_get_time -tests\Dev11_0845312_comprehensive_floating_point -tests\Dev11_0863628_atomic_compare_exchange -tests\Dev11_0920385_list_sort_allocator -tests\Dev11_1003120_search_test -tests\Dev11_1066589_shared_ptr_atomic_deadlock -tests\Dev11_1066931_filesystem_rename_noop -tests\Dev11_1074023_constexpr -tests\Dev11_1086953_call_once_overhaul -tests\Dev11_1114006_condition_variable_pred -tests\Dev11_1127004_future_has_exceptions_0 -tests\Dev11_1131212_uncaught_exceptions -tests\Dev11_1137366_nested_exception -tests\Dev11_1140665_unique_ptr_array_conversions -tests\Dev11_1150223_shared_mutex -tests\Dev11_1158803_regex_thread_safety -tests\Dev11_1180290_filesystem_error_code -tests\GH_000457_system_error_message -tests\GH_000545_include_compare -tests\GH_000625_vector_bool_optimization -tests\GH_000685_condition_variable_any -tests\GH_000690_overaligned_function -tests\GH_000890_pow_template -tests\GH_000940_missing_valarray_copy -tests\GH_001001_random_rejection_rounding -tests\GH_001010_filesystem_error_encoding -tests\GH_001017_discrete_distribution_out_of_range -tests\GH_001086_partial_sort_copy -tests\GH_001123_random_cast_out_of_range -tests\LWG2597_complex_branch_cut -tests\LWG3018_shared_ptr_function -tests\P0019R8_atomic_ref -tests\P0024R2_parallel_algorithms_adjacent_difference -tests\P0024R2_parallel_algorithms_adjacent_find -tests\P0024R2_parallel_algorithms_all_of -tests\P0024R2_parallel_algorithms_count -tests\P0024R2_parallel_algorithms_equal -tests\P0024R2_parallel_algorithms_exclusive_scan -tests\P0024R2_parallel_algorithms_find -tests\P0024R2_parallel_algorithms_find_end -tests\P0024R2_parallel_algorithms_find_first_of -tests\P0024R2_parallel_algorithms_for_each -tests\P0024R2_parallel_algorithms_inclusive_scan -tests\P0024R2_parallel_algorithms_is_heap -tests\P0024R2_parallel_algorithms_is_partitioned -tests\P0024R2_parallel_algorithms_is_sorted -tests\P0024R2_parallel_algorithms_mismatch -tests\P0024R2_parallel_algorithms_partition -tests\P0024R2_parallel_algorithms_reduce -tests\P0024R2_parallel_algorithms_remove -tests\P0024R2_parallel_algorithms_replace -tests\P0024R2_parallel_algorithms_search -tests\P0024R2_parallel_algorithms_search_n -tests\P0024R2_parallel_algorithms_set_difference -tests\P0024R2_parallel_algorithms_set_intersection -tests\P0024R2_parallel_algorithms_sort -tests\P0024R2_parallel_algorithms_stable_sort -tests\P0024R2_parallel_algorithms_transform -tests\P0024R2_parallel_algorithms_transform_exclusive_scan -tests\P0024R2_parallel_algorithms_transform_inclusive_scan -tests\P0024R2_parallel_algorithms_transform_reduce -tests\P0035R4_over_aligned_allocation -tests\P0040R3_extending_memory_management_tools -tests\P0067R5_charconv -tests\P0083R3_splicing_maps_and_sets -tests\P0088R3_variant -tests\P0092R1_polishing_chrono -tests\P0122R7_span -tests\P0122R7_span_death -tests\P0137R1_launder -tests\P0156R2_scoped_lock -tests\P0202R3_constexpr_algorithm_and_exchange -tests\P0218R1_filesystem -tests\P0220R1_any -tests\P0220R1_optional -tests\P0220R1_polymorphic_memory_resources -tests\P0220R1_sample -tests\P0220R1_searchers -tests\P0220R1_string_view -tests\P0325R4_to_array -tests\P0356R5_bind_front -tests\P0357R3_supporting_incomplete_types_in_reference_wrapper -tests\P0414R2_shared_ptr_for_arrays -tests\P0415R1_constexpr_complex -tests\P0426R1_constexpr_char_traits -tests\P0433R2_deduction_guides -tests\P0476R2_bit_cast -tests\P0487R1_fixing_operator_shl_basic_istream_char_pointer -tests\P0513R0_poisoning_the_hash -tests\P0528R3_cmpxchg_pad -tests\P0553R4_bit_rotating_and_counting_functions -tests\P0556R3_bit_integral_power_of_two_operations -tests\P0586R2_integer_comparison -tests\P0595R2_is_constant_evaluated -tests\P0607R0_inline_variables -tests\P0616R0_using_move_in_numeric -tests\P0631R8_numbers_math_constants -tests\P0674R1_make_shared_for_arrays -tests\P0718R2_atomic_smart_ptrs -tests\P0758R1_is_nothrow_convertible -tests\P0768R1_spaceship_operator -tests\P0769R2_shift_left_shift_right -tests\P0784R7_library_support_for_more_constexpr_containers -tests\P0811R3_midpoint_lerp -tests\P0896R4_counted_iterator -tests\P0896R4_counted_iterator_death -tests\P0896R4_P1614R2_comparisons -tests\P0896R4_ranges_alg_adjacent_find -tests\P0896R4_ranges_alg_all_of -tests\P0896R4_ranges_alg_any_of -tests\P0896R4_ranges_alg_binary_search -tests\P0896R4_ranges_alg_copy -tests\P0896R4_ranges_alg_copy_backward -tests\P0896R4_ranges_alg_copy_if -tests\P0896R4_ranges_alg_copy_n -tests\P0896R4_ranges_alg_count -tests\P0896R4_ranges_alg_count_if -tests\P0896R4_ranges_alg_equal -tests\P0896R4_ranges_alg_fill -tests\P0896R4_ranges_alg_fill_n -tests\P0896R4_ranges_alg_find -tests\P0896R4_ranges_alg_find_end -tests\P0896R4_ranges_alg_find_first_of -tests\P0896R4_ranges_alg_find_if -tests\P0896R4_ranges_alg_find_if_not -tests\P0896R4_ranges_alg_for_each -tests\P0896R4_ranges_alg_for_each_n -tests\P0896R4_ranges_alg_generate -tests\P0896R4_ranges_alg_generate_n -tests\P0896R4_ranges_alg_heap -tests\P0896R4_ranges_alg_includes -tests\P0896R4_ranges_alg_is_permutation -tests\P0896R4_ranges_alg_is_sorted -tests\P0896R4_ranges_alg_lexicographical_compare -tests\P0896R4_ranges_alg_merge -tests\P0896R4_ranges_alg_minmax -tests\P0896R4_ranges_alg_mismatch -tests\P0896R4_ranges_alg_move -tests\P0896R4_ranges_alg_move_backward -tests\P0896R4_ranges_alg_none_of -tests\P0896R4_ranges_alg_nth_element -tests\P0896R4_ranges_alg_partition -tests\P0896R4_ranges_alg_partition_copy -tests\P0896R4_ranges_alg_partition_point -tests\P0896R4_ranges_alg_permutations -tests\P0896R4_ranges_alg_remove -tests\P0896R4_ranges_alg_remove_copy -tests\P0896R4_ranges_alg_remove_copy_if -tests\P0896R4_ranges_alg_remove_if -tests\P0896R4_ranges_alg_replace -tests\P0896R4_ranges_alg_replace_copy -tests\P0896R4_ranges_alg_replace_copy_if -tests\P0896R4_ranges_alg_replace_if -tests\P0896R4_ranges_alg_reverse -tests\P0896R4_ranges_alg_reverse_copy -tests\P0896R4_ranges_alg_rotate -tests\P0896R4_ranges_alg_rotate_copy -tests\P0896R4_ranges_alg_sample -tests\P0896R4_ranges_alg_search -tests\P0896R4_ranges_alg_search_n -tests\P0896R4_ranges_alg_set_difference -tests\P0896R4_ranges_alg_set_intersection -tests\P0896R4_ranges_alg_set_symmetric_difference -tests\P0896R4_ranges_alg_set_union -tests\P0896R4_ranges_alg_shuffle -tests\P0896R4_ranges_alg_sort -tests\P0896R4_ranges_alg_swap_ranges -tests\P0896R4_ranges_alg_transform_binary -tests\P0896R4_ranges_alg_transform_unary -tests\P0896R4_ranges_alg_uninitialized_move -tests\P0896R4_ranges_alg_unique -tests\P0896R4_ranges_alg_unique_copy -tests\P0896R4_ranges_algorithm_machinery -tests\P0896R4_ranges_iterator_machinery -tests\P0896R4_ranges_range_machinery -tests\P0896R4_ranges_subrange -tests\P0896R4_ranges_test_machinery -tests\P0896R4_ranges_to_address -tests\P0898R3_concepts -tests\P0898R3_identity -tests\P0919R3_heterogeneous_unordered_lookup -tests\P0966R1_string_reserve_should_not_shrink -tests\P1023R0_constexpr_for_array_comparisons -tests\P1032R1_miscellaneous_constexpr -tests\P1135R6_atomic_flag_test -tests\P1135R6_atomic_wait -tests\P1135R6_atomic_wait_vista -tests\P1165R1_consistently_propagating_stateful_allocators -tests\P1423R3_char8_t_remediation -tests\P1645R1_constexpr_numeric -tests\VSO_0000000_allocator_propagation -tests\VSO_0000000_any_calling_conventions -tests\VSO_0000000_c_math_functions -tests\VSO_0000000_condition_variable_any_exceptions -tests\VSO_0000000_container_allocator_constructors -tests\VSO_0000000_exception_ptr_rethrow_seh -tests\VSO_0000000_fancy_pointers -tests\VSO_0000000_has_static_rtti -tests\VSO_0000000_initialize_everything -tests\VSO_0000000_instantiate_algorithms_16_difference_type_1 -tests\VSO_0000000_instantiate_algorithms_16_difference_type_2 -tests\VSO_0000000_instantiate_algorithms_32_difference_type_1 -tests\VSO_0000000_instantiate_algorithms_32_difference_type_2 -tests\VSO_0000000_instantiate_algorithms_64_difference_type_1 -tests\VSO_0000000_instantiate_algorithms_64_difference_type_2 -tests\VSO_0000000_instantiate_algorithms_int_1 -tests\VSO_0000000_instantiate_algorithms_int_2 -tests\VSO_0000000_instantiate_algorithms_nontrivial_1 -tests\VSO_0000000_instantiate_algorithms_nontrivial_2 -tests\VSO_0000000_instantiate_containers -tests\VSO_0000000_instantiate_cvt -tests\VSO_0000000_instantiate_iterators_misc -tests\VSO_0000000_instantiate_type_traits -tests\VSO_0000000_list_iterator_debugging -tests\VSO_0000000_list_unique_self_reference -tests\VSO_0000000_matching_npos_address -tests\VSO_0000000_more_pair_tuple_sfinae -tests\VSO_0000000_nullptr_stream_out -tests\VSO_0000000_oss_workarounds -tests\VSO_0000000_path_stream_parameter -tests\VSO_0000000_regex_interface -tests\VSO_0000000_regex_use -tests\VSO_0000000_strengthened_noexcept -tests\VSO_0000000_string_view_idl -tests\VSO_0000000_type_traits -tests\VSO_0000000_vector_algorithms -tests\VSO_0000000_wcfb01_idempotent_container_destructors -tests\VSO_0000000_wchar_t_filebuf_xsmeown -tests\VSO_0095468_clr_exception_ptr_bad_alloc -tests\VSO_0095837_current_exception_dtor -tests\VSO_0099869_pow_float_overflow -tests\VSO_0102478_moving_allocators -tests\VSO_0104705_throwing_copy_in_current_exception -tests\VSO_0104705_throwing_copy_in_current_exception_seh -tests\VSO_0105317_expression_sfinae -tests\VSO_0118461_min_max_noexcept -tests\VSO_0121275_filesystem_canonical_should_handle_many_double_dots -tests\VSO_0121440_is_iterator_iterator_traits -tests\VSO_0131167_associative_emplacement_allocations -tests\VSO_0135428_custom_char_traits_string -tests\VSO_0144114_sleep_until -tests\VSO_0144294_unordered_map_max_bucket_count -tests\VSO_0149983_system_error_broken_pipe -tests\VSO_0157762_feature_test_macros -tests\VSO_0174871_string_replace -tests\VSO_0180466_algorithm_overhauls -tests\VSO_0180469_fill_family -tests\VSO_0180469_ptr_cat -tests\VSO_0191296_allocator_construct -tests\VSO_0204655_heap_algorithms_integer_overflow -tests\VSO_0224478_scoped_allocator -tests\VSO_0226079_mutex -tests\VSO_0234888_num_get_overflows -tests\VSO_0299624_checked_array_iterator_idl -tests\VSO_0397980_codecvt_length -tests\VSO_0429900_fast_debug_range_based_for -tests\VSO_0474901_shift_jis_codecvt -tests\VSO_0493909_is_aggregate -tests\VSO_0512710_terminate_current_exception_from_noexcept_function -tests\VSO_0512710_terminate_current_exception_from_noexcept_function_2 -tests\VSO_0512710_terminate_current_exception_from_unwind -tests\VSO_0527559_pragma_managed -tests\VSO_0575109_string_ambiguous_overloads -tests\VSO_0599804_seekg_zero -tests\VSO_0644691_utf_8_codecvt -tests\VSO_0663136_string_includes_cctype -tests\VSO_0664587_lcg_divide_by_zero -tests\VSO_0677157_flist_merge_edge_cases -tests\VSO_0735700_fstream_read_over_4k -tests\VSO_0736657_unordered_assign_rehash -tests\VSO_0744055_atomic_load_8_bytes_readonly -tests\VSO_0792651_unordered_set_rehash_invalidates_key -tests\VSO_0830211_container_debugging_range_checks -tests\VSO_0849827_multicontainer_emplace_hint_position -tests\VSO_0938757_attribute_order -tests\VSO_0961751_hash_range_erase -tests\VSO_0971246_legacy_await_headers +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +tests\Dev08_496675_iostream_int_reading +tests\Dev08_527068_scl_no_exceptions +tests\Dev08_563686_ostream +tests\Dev08_563705_std_malloc_free +tests\Dev08_576265_list_remove +tests\Dev08_584299_search_n +tests\Dev09_012361_vector_swap +tests\Dev09_052961_has_iterator_debugging_0 +tests\Dev09_056375_locale_cleanup +tests\Dev09_098637_stl_function_typeids +tests\Dev09_119637_throwing_string_with_hid0 +tests\Dev09_119644_compiler_option_gz +tests\Dev09_126254_persistent_aux_allocators +tests\Dev09_130060_unique_copy +tests\Dev09_152755_tr1_nested_bind +tests\Dev09_153419_tr1_allocators +tests\Dev09_154033_tr1_predicate_search_n +tests\Dev09_155328_tr1_vector_of_set +tests\Dev09_158181_tr1_unordered_meow_swap +tests\Dev09_158457_tr1_mem_fn_calling_conventions +tests\Dev09_161106_tr1_bind_templated_fxn_call_operator +tests\Dev09_165853_tr1_tuple_swap +tests\Dev09_171205_tr1_assign_pair_to_tuple +tests\Dev09_172497_tr1_mem_fn_const_correctness +tests\Dev09_172505_tr1_bind_reference_wrapper +tests\Dev09_172666_tr1_tuple_odr +tests\Dev09_173612_tr1_regex_leak +tests\Dev09_174589_tr1_function_storing_pmf_called_with_reference_or_pointer +tests\Dev09_175314_tr1_reference_wrapper_assignment +tests\Dev09_175716_tr1_dereferencing_reference_wrapper +tests\Dev09_176467_tr1_make_tuple_from_string_literal +tests\Dev09_176498_tr1_binding_functors_with_non_const_fxn_call_ops +tests\Dev09_181509_tr1_inf_loop_uniform_int_ull +tests\Dev09_182017_tr1_search_n +tests\Dev09_186118_stoullx_corner_cases +tests\Dev09_192736_tr1_prngs_not_copyconstructible +tests\Dev09_195561_tr1_function_const_op +tests\Dev09_196243_tr1_enable_shared_from_this_ops +tests\Dev09_199123_tr1_mem_fun_abstract_classes +tests\Dev10_391723_bind_result_type +tests\Dev10_414242_facet_bug_use_facet_ctype_char +tests\Dev10_441756_function_reference_wrapper +tests\Dev10_445289_make_shared +tests\Dev10_470547_facet_bug_stringstream +tests\Dev10_482830_header_only_string +tests\Dev10_491486_floating_point_hash +tests\Dev10_492345_tr1_function_swap +tests\Dev10_498944_enable_shared_from_this_auto_ptr +tests\Dev10_500860_overloaded_address_of +tests\Dev10_544258_heterogeneous_comparisons +tests\Dev10_555491_complex_linker_errors +tests\Dev10_561430_list_and_tree_leaks +tests\Dev10_562056_tree_leak +tests\Dev10_563443_empty_vector_begin_plus_zero +tests\Dev10_567556_move_from_empty_list +tests\Dev10_579381_vector_grow_to +tests\Dev10_590599_hash_string +tests\Dev10_609053_ctype_char_table_size +tests\Dev10_617014_tuple_tie +tests\Dev10_632876_regex_proxy +tests\Dev10_635436_shared_ptr_reset +tests\Dev10_639436_const_map_at +tests\Dev10_646244_bad_alloc_message +tests\Dev10_646556_construct_tuple_from_const +tests\Dev10_654977_655012_shared_ptr_move +tests\Dev10_661739_tuple_copy_ctors +tests\Dev10_682964_stable_sort_warnings +tests\Dev10_689595_back_inserter_vector_bool +tests\Dev10_709166_checked_and_unchecked_array_iterator +tests\Dev10_709168_marking_iterators_as_checked +tests\Dev10_722102_shared_ptr_nullptr +tests\Dev10_729003_bind_reference_wrapper +tests\Dev10_766948_insert_ambiguity +tests\Dev10_780098_movable_elements +tests\Dev10_783436_rvalue_string_plus +tests\Dev10_809142_copy_n_istream_iterator +tests\Dev10_814245_regex_character_class_crash +tests\Dev10_816787_swap_vector_bool_elements +tests\Dev10_847656_shared_ptr_is_convertible +tests\Dev10_851347_weak_ptr_virtual_inheritance +tests\Dev10_860410_bitset_ctors +tests\Dev10_860421_deque_push_back_pop_front +tests\Dev10_881629_vector_erase_return_value +tests\Dev10_904413_moved_from_function_should_be_empty +tests\Dev10_905461_is_sorted_until +tests\Dev10_908702_string_memory_leak +tests\Dev10_909646_stringstream_vd2 +tests\Dev11_0000000_dual_range_algorithms +tests\Dev11_0000000_function_crashes +tests\Dev11_0000000_include_each_header_alone +tests\Dev11_0000000_null_forward_iterators +tests\Dev11_0000000_quoted +tests\Dev11_0000000_rotate_test +tests\Dev11_0000000_tuple_cat +tests\Dev11_0000000_user_defined_literals +tests\Dev11_0019127_singular_iterators +tests\Dev11_0091392_string_erase_resize_perf +tests\Dev11_0133625_locale0_implib_cpp +tests\Dev11_0135139_vector_bool_equality_perf +tests\Dev11_0235721_async_and_packaged_task +tests\Dev11_0253803_debug_pointer +tests\Dev11_0272959_make_signed +tests\Dev11_0289403_partition_point_complexity +tests\Dev11_0299014_exception_ptr_requirements +tests\Dev11_0302476_pair_move +tests\Dev11_0314451_make_pair_make_tuple +tests\Dev11_0316853_find_memchr_optimization +tests\Dev11_0343056_pair_tuple_ctor_sfinae +tests\Dev11_0376122_grand_theft_bind +tests\Dev11_0377755_thread_ctor_move_only_types +tests\Dev11_0387701_container_equality +tests\Dev11_0417110_nullptr_t_is_scalar +tests\Dev11_0435439_call_once_deadlock +tests\Dev11_0437519_container_behavior +tests\Dev11_0437519_container_requirements +tests\Dev11_0447546_facet_allocation +tests\Dev11_0453373_codecvt_compiles +tests\Dev11_0483851_vector_debug_allocator_use +tests\Dev11_0485243_condition_variable_crash +tests\Dev11_0493504_error_category_lifetime +tests\Dev11_0494593_time_put_wchar_t +tests\Dev11_0496153_locale_ctor +tests\Dev11_0532622_minmax_element +tests\Dev11_0535636_functional_overhaul +tests\Dev11_0555154_system_clock_to_time_t +tests\Dev11_0577418_random_seed_0 +tests\Dev11_0579795_inplace_merge_out_of_memory +tests\Dev11_0607540_pair_tuple_rvalue_references +tests\Dev11_0617384_empty_std_function +tests\Dev11_0653897_codecvt_partial +tests\Dev11_0671816_list_splice +tests\Dev11_0696045_future_wait_for +tests\Dev11_0704582_ratio +tests\Dev11_0732166_unordered_strong_guarantee +tests\Dev11_0748972_function_crash_out_of_memory +tests\Dev11_0823534_transparent_lookup +tests\Dev11_0835323_to_string +tests\Dev11_0836436_get_time +tests\Dev11_0845312_comprehensive_floating_point +tests\Dev11_0863628_atomic_compare_exchange +tests\Dev11_0920385_list_sort_allocator +tests\Dev11_1003120_search_test +tests\Dev11_1066589_shared_ptr_atomic_deadlock +tests\Dev11_1066931_filesystem_rename_noop +tests\Dev11_1074023_constexpr +tests\Dev11_1086953_call_once_overhaul +tests\Dev11_1114006_condition_variable_pred +tests\Dev11_1127004_future_has_exceptions_0 +tests\Dev11_1131212_uncaught_exceptions +tests\Dev11_1137366_nested_exception +tests\Dev11_1140665_unique_ptr_array_conversions +tests\Dev11_1150223_shared_mutex +tests\Dev11_1158803_regex_thread_safety +tests\Dev11_1180290_filesystem_error_code +tests\GH_000457_system_error_message +tests\GH_000545_include_compare +tests\GH_000625_vector_bool_optimization +tests\GH_000685_condition_variable_any +tests\GH_000690_overaligned_function +tests\GH_000890_pow_template +tests\GH_000940_missing_valarray_copy +tests\GH_001001_random_rejection_rounding +tests\GH_001010_filesystem_error_encoding +tests\GH_001017_discrete_distribution_out_of_range +tests\GH_001086_partial_sort_copy +tests\GH_001123_random_cast_out_of_range +tests\LWG2597_complex_branch_cut +tests\LWG3018_shared_ptr_function +tests\P0019R8_atomic_ref +tests\P0024R2_parallel_algorithms_adjacent_difference +tests\P0024R2_parallel_algorithms_adjacent_find +tests\P0024R2_parallel_algorithms_all_of +tests\P0024R2_parallel_algorithms_count +tests\P0024R2_parallel_algorithms_equal +tests\P0024R2_parallel_algorithms_exclusive_scan +tests\P0024R2_parallel_algorithms_find +tests\P0024R2_parallel_algorithms_find_end +tests\P0024R2_parallel_algorithms_find_first_of +tests\P0024R2_parallel_algorithms_for_each +tests\P0024R2_parallel_algorithms_inclusive_scan +tests\P0024R2_parallel_algorithms_is_heap +tests\P0024R2_parallel_algorithms_is_partitioned +tests\P0024R2_parallel_algorithms_is_sorted +tests\P0024R2_parallel_algorithms_mismatch +tests\P0024R2_parallel_algorithms_partition +tests\P0024R2_parallel_algorithms_reduce +tests\P0024R2_parallel_algorithms_remove +tests\P0024R2_parallel_algorithms_replace +tests\P0024R2_parallel_algorithms_search +tests\P0024R2_parallel_algorithms_search_n +tests\P0024R2_parallel_algorithms_set_difference +tests\P0024R2_parallel_algorithms_set_intersection +tests\P0024R2_parallel_algorithms_sort +tests\P0024R2_parallel_algorithms_stable_sort +tests\P0024R2_parallel_algorithms_transform +tests\P0024R2_parallel_algorithms_transform_exclusive_scan +tests\P0024R2_parallel_algorithms_transform_inclusive_scan +tests\P0024R2_parallel_algorithms_transform_reduce +tests\P0035R4_over_aligned_allocation +tests\P0040R3_extending_memory_management_tools +tests\P0067R5_charconv +tests\P0083R3_splicing_maps_and_sets +tests\P0088R3_variant +tests\P0092R1_polishing_chrono +tests\P0122R7_span +tests\P0122R7_span_death +tests\P0137R1_launder +tests\P0156R2_scoped_lock +tests\P0202R3_constexpr_algorithm_and_exchange +tests\P0218R1_filesystem +tests\P0220R1_any +tests\P0220R1_optional +tests\P0220R1_polymorphic_memory_resources +tests\P0220R1_sample +tests\P0220R1_searchers +tests\P0220R1_string_view +tests\P0325R4_to_array +tests\P0356R5_bind_front +tests\P0357R3_supporting_incomplete_types_in_reference_wrapper +tests\P0414R2_shared_ptr_for_arrays +tests\P0415R1_constexpr_complex +tests\P0426R1_constexpr_char_traits +tests\P0433R2_deduction_guides +tests\P0476R2_bit_cast +tests\P0487R1_fixing_operator_shl_basic_istream_char_pointer +tests\P0513R0_poisoning_the_hash +tests\P0528R3_cmpxchg_pad +tests\P0553R4_bit_rotating_and_counting_functions +tests\P0556R3_bit_integral_power_of_two_operations +tests\P0586R2_integer_comparison +tests\P0595R2_is_constant_evaluated +tests\P0607R0_inline_variables +tests\P0616R0_using_move_in_numeric +tests\P0631R8_numbers_math_constants +tests\P0674R1_make_shared_for_arrays +tests\P0718R2_atomic_smart_ptrs +tests\P0758R1_is_nothrow_convertible +tests\P0768R1_spaceship_operator +tests\P0769R2_shift_left_shift_right +tests\P0784R7_library_support_for_more_constexpr_containers +tests\P0811R3_midpoint_lerp +tests\P0896R4_counted_iterator +tests\P0896R4_counted_iterator_death +tests\P0896R4_P1614R2_comparisons +tests\P0896R4_ranges_alg_adjacent_find +tests\P0896R4_ranges_alg_all_of +tests\P0896R4_ranges_alg_any_of +tests\P0896R4_ranges_alg_binary_search +tests\P0896R4_ranges_alg_copy +tests\P0896R4_ranges_alg_copy_backward +tests\P0896R4_ranges_alg_copy_if +tests\P0896R4_ranges_alg_copy_n +tests\P0896R4_ranges_alg_count +tests\P0896R4_ranges_alg_count_if +tests\P0896R4_ranges_alg_equal +tests\P0896R4_ranges_alg_fill +tests\P0896R4_ranges_alg_fill_n +tests\P0896R4_ranges_alg_find +tests\P0896R4_ranges_alg_find_end +tests\P0896R4_ranges_alg_find_first_of +tests\P0896R4_ranges_alg_find_if +tests\P0896R4_ranges_alg_find_if_not +tests\P0896R4_ranges_alg_for_each +tests\P0896R4_ranges_alg_for_each_n +tests\P0896R4_ranges_alg_generate +tests\P0896R4_ranges_alg_generate_n +tests\P0896R4_ranges_alg_heap +tests\P0896R4_ranges_alg_includes +tests\P0896R4_ranges_alg_is_permutation +tests\P0896R4_ranges_alg_is_sorted +tests\P0896R4_ranges_alg_lexicographical_compare +tests\P0896R4_ranges_alg_merge +tests\P0896R4_ranges_alg_minmax +tests\P0896R4_ranges_alg_mismatch +tests\P0896R4_ranges_alg_move +tests\P0896R4_ranges_alg_move_backward +tests\P0896R4_ranges_alg_none_of +tests\P0896R4_ranges_alg_nth_element +tests\P0896R4_ranges_alg_partition +tests\P0896R4_ranges_alg_partition_copy +tests\P0896R4_ranges_alg_partition_point +tests\P0896R4_ranges_alg_permutations +tests\P0896R4_ranges_alg_remove +tests\P0896R4_ranges_alg_remove_copy +tests\P0896R4_ranges_alg_remove_copy_if +tests\P0896R4_ranges_alg_remove_if +tests\P0896R4_ranges_alg_replace +tests\P0896R4_ranges_alg_replace_copy +tests\P0896R4_ranges_alg_replace_copy_if +tests\P0896R4_ranges_alg_replace_if +tests\P0896R4_ranges_alg_reverse +tests\P0896R4_ranges_alg_reverse_copy +tests\P0896R4_ranges_alg_rotate +tests\P0896R4_ranges_alg_rotate_copy +tests\P0896R4_ranges_alg_sample +tests\P0896R4_ranges_alg_search +tests\P0896R4_ranges_alg_search_n +tests\P0896R4_ranges_alg_set_difference +tests\P0896R4_ranges_alg_set_intersection +tests\P0896R4_ranges_alg_set_symmetric_difference +tests\P0896R4_ranges_alg_set_union +tests\P0896R4_ranges_alg_shuffle +tests\P0896R4_ranges_alg_sort +tests\P0896R4_ranges_alg_swap_ranges +tests\P0896R4_ranges_alg_transform_binary +tests\P0896R4_ranges_alg_transform_unary +tests\P0896R4_ranges_alg_uninitialized_move +tests\P0896R4_ranges_alg_unique +tests\P0896R4_ranges_alg_unique_copy +tests\P0896R4_ranges_algorithm_machinery +tests\P0896R4_ranges_iterator_machinery +tests\P0896R4_ranges_range_machinery +tests\P0896R4_ranges_subrange +tests\P0896R4_ranges_test_machinery +tests\P0896R4_ranges_to_address +tests\P0898R3_concepts +tests\P0898R3_identity +tests\P0919R3_heterogeneous_unordered_lookup +tests\P0966R1_string_reserve_should_not_shrink +tests\P1023R0_constexpr_for_array_comparisons +tests\P1032R1_miscellaneous_constexpr +tests\P1135R6_atomic_flag_test +tests\P1135R6_atomic_wait +tests\P1135R6_atomic_wait_vista +tests\P1165R1_consistently_propagating_stateful_allocators +tests\P1423R3_char8_t_remediation +tests\P1645R1_constexpr_numeric +tests\VSO_0000000_allocator_propagation +tests\VSO_0000000_any_calling_conventions +tests\VSO_0000000_c_math_functions +tests\VSO_0000000_condition_variable_any_exceptions +tests\VSO_0000000_container_allocator_constructors +tests\VSO_0000000_exception_ptr_rethrow_seh +tests\VSO_0000000_fancy_pointers +tests\VSO_0000000_has_static_rtti +tests\VSO_0000000_initialize_everything +tests\VSO_0000000_instantiate_algorithms_16_difference_type_1 +tests\VSO_0000000_instantiate_algorithms_16_difference_type_2 +tests\VSO_0000000_instantiate_algorithms_32_difference_type_1 +tests\VSO_0000000_instantiate_algorithms_32_difference_type_2 +tests\VSO_0000000_instantiate_algorithms_64_difference_type_1 +tests\VSO_0000000_instantiate_algorithms_64_difference_type_2 +tests\VSO_0000000_instantiate_algorithms_int_1 +tests\VSO_0000000_instantiate_algorithms_int_2 +tests\VSO_0000000_instantiate_algorithms_nontrivial_1 +tests\VSO_0000000_instantiate_algorithms_nontrivial_2 +tests\VSO_0000000_instantiate_containers +tests\VSO_0000000_instantiate_cvt +tests\VSO_0000000_instantiate_iterators_misc +tests\VSO_0000000_instantiate_type_traits +tests\VSO_0000000_list_iterator_debugging +tests\VSO_0000000_list_unique_self_reference +tests\VSO_0000000_matching_npos_address +tests\VSO_0000000_more_pair_tuple_sfinae +tests\VSO_0000000_nullptr_stream_out +tests\VSO_0000000_oss_workarounds +tests\VSO_0000000_path_stream_parameter +tests\VSO_0000000_regex_interface +tests\VSO_0000000_regex_use +tests\VSO_0000000_strengthened_noexcept +tests\VSO_0000000_string_view_idl +tests\VSO_0000000_type_traits +tests\VSO_0000000_vector_algorithms +tests\VSO_0000000_wcfb01_idempotent_container_destructors +tests\VSO_0000000_wchar_t_filebuf_xsmeown +tests\VSO_0095468_clr_exception_ptr_bad_alloc +tests\VSO_0095837_current_exception_dtor +tests\VSO_0099869_pow_float_overflow +tests\VSO_0102478_moving_allocators +tests\VSO_0104705_throwing_copy_in_current_exception +tests\VSO_0104705_throwing_copy_in_current_exception_seh +tests\VSO_0105317_expression_sfinae +tests\VSO_0118461_min_max_noexcept +tests\VSO_0121275_filesystem_canonical_should_handle_many_double_dots +tests\VSO_0121440_is_iterator_iterator_traits +tests\VSO_0131167_associative_emplacement_allocations +tests\VSO_0135428_custom_char_traits_string +tests\VSO_0144114_sleep_until +tests\VSO_0144294_unordered_map_max_bucket_count +tests\VSO_0149983_system_error_broken_pipe +tests\VSO_0157762_feature_test_macros +tests\VSO_0174871_string_replace +tests\VSO_0180466_algorithm_overhauls +tests\VSO_0180469_fill_family +tests\VSO_0180469_ptr_cat +tests\VSO_0191296_allocator_construct +tests\VSO_0204655_heap_algorithms_integer_overflow +tests\VSO_0224478_scoped_allocator +tests\VSO_0226079_mutex +tests\VSO_0234888_num_get_overflows +tests\VSO_0299624_checked_array_iterator_idl +tests\VSO_0397980_codecvt_length +tests\VSO_0429900_fast_debug_range_based_for +tests\VSO_0474901_shift_jis_codecvt +tests\VSO_0493909_is_aggregate +tests\VSO_0512710_terminate_current_exception_from_noexcept_function +tests\VSO_0512710_terminate_current_exception_from_noexcept_function_2 +tests\VSO_0512710_terminate_current_exception_from_unwind +tests\VSO_0527559_pragma_managed +tests\VSO_0575109_string_ambiguous_overloads +tests\VSO_0599804_seekg_zero +tests\VSO_0644691_utf_8_codecvt +tests\VSO_0663136_string_includes_cctype +tests\VSO_0664587_lcg_divide_by_zero +tests\VSO_0677157_flist_merge_edge_cases +tests\VSO_0735700_fstream_read_over_4k +tests\VSO_0736657_unordered_assign_rehash +tests\VSO_0744055_atomic_load_8_bytes_readonly +tests\VSO_0792651_unordered_set_rehash_invalidates_key +tests\VSO_0830211_container_debugging_range_checks +tests\VSO_0849827_multicontainer_emplace_hint_position +tests\VSO_0938757_attribute_order +tests\VSO_0961751_hash_range_erase +tests\VSO_0971246_legacy_await_headers diff --git a/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp b/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp index bc5146d1bb..08db1d6645 100644 --- a/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp +++ b/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp @@ -1,8 +1,8 @@ #include -#include -#include #include +#include #include +#include void Test_GH1001() { constexpr int N{1000}; @@ -26,15 +26,15 @@ void Test_GH1001() { const double p0_x{static_cast(count[0]) / iters}; const double p1_x{static_cast(count[1]) / iters}; - const double p0{std::pow(1.0-p,static_cast(N))}; - const double p1{1000.0*p*std::pow(1.0-p,static_cast(N-1))}; + const double p0{std::pow(1.0 - p, static_cast(N))}; + const double p1{1000.0 * p * std::pow(1.0 - p, static_cast(N - 1))}; const double mean{p * N}; - assert(mean_x/mean - 1.0 < 0.002); + assert(mean_x / mean - 1.0 < 0.002); assert(p0_x / p0 - 1.0 < 0.002); assert(p1_x / p1 - 1.0 < 0.002); } int main() { Test_GH1001(); -} \ No newline at end of file +} diff --git a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp index 1d3176bbf7..f2f6a662be 100644 --- a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp +++ b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp @@ -1,8 +1,8 @@ #include -#include +#include #include #include -#include +#include template using lim = std::numeric_limits; @@ -66,4 +66,4 @@ int main() { TestTruncExhaustive(); TestTruncExhaustive(); TestTruncSelective(); -} \ No newline at end of file +} From 8e31f45f4e3eb7f9d95b330e0f5c038946561df7 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Mon, 17 Aug 2020 12:33:50 -0700 Subject: [PATCH 06/13] buildfix and code review comments --- stl/inc/random | 52 +++++++++---------- .../test.cpp | 6 +-- .../test.cpp | 50 +++++++++--------- 3 files changed, 52 insertions(+), 56 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index f36fda1c5d..d2bbb9565c 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2027,37 +2027,33 @@ basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, return _Dist._Write(_Ostr); } -// FUNCTION TEMPLATE _Trunc_to_float +// FUNCTION TEMPLATE _Float_upper_bound -// - Returns largest _Flt s.t. static_cast<_Ty>(_Result) <= _Val -// - First truncate to largest _Flt <= _Val, then add ceil(ulp)-ulp. If -// ulp > 1, this is a nop, so skip the expensive nextafter call. +// Returns smallest _Flt s.t. static_cast<_Ty>(_Result) > _Val. First +// truncate to largest _Flt <= _Val, then add ceil(ulp) -template -_NODISCARD inline _Flt _Trunc_to_float(_Ty _Val) { +template && is_floating_point_v<_Flt>>> +_NODISCARD inline _Flt _Float_upper_bound(_Ty _Val) { constexpr auto _Ty_digits = numeric_limits<_Ty>::digits; constexpr auto _Flt_digits = numeric_limits<_Flt>::digits; - // workaround for lack of constexpr-if to avoid negative shift warning - constexpr auto _Abs_diff_digits = (_Ty_digits > _Flt_digits) ? _Ty_digits - _Flt_digits : _Flt_digits - _Ty_digits; if _CONSTEXPR_IF (_Ty_digits <= _Flt_digits) { - _Flt _Result = _Val < numeric_limits<_Ty>::max() - ? static_cast<_Flt>(_Val + _Ty{1}) - : _STD exp2(static_cast<_Flt>(_STD numeric_limits<_Ty>::digits)); - return _STD nextafter(_Result, _Flt{0.0}); + return static_cast<_Flt>(_Val) + _Flt{1}; } else { #pragma warning(push) #pragma warning(disable : 4146) // unary minus of unsigned - constexpr auto _Mask = _Ty(-1) << _Abs_diff_digits; - const auto _Log = _Floor_of_log_2(_Val); - const auto _Shifted_mask = _Mask >> (_Ty_digits - 1 - _Log); - const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; + constexpr auto _Mask_shift = (_Ty_digits > _Flt_digits) ? _Ty_digits - _Flt_digits : 0; + constexpr auto _Mask = _Ty(-1) << _Mask_shift; + const auto _Log = _Floor_of_log_2(_Val); + const auto _Shifted_mask = _Mask >> (_Ty_digits - 1 - _Log); + const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; _Val &= _Shifted_mask; - if (_Ceil_ulp > _Ty{1}) { - return static_cast<_Flt>(_Val); + if (_Val == _Mask) { + // integer add would overflow + constexpr auto _Big_ulp = static_cast<_Flt>(_Mask & -_Mask); + return static_cast<_Flt>(_Val) + _Big_ulp; } else { - const auto _Result = static_cast<_Flt>(_Val + _Ceil_ulp); - return _STD nextafter(_Result, _Flt{0.0}); + return static_cast<_Flt>(_Val + _Ceil_ulp); } #pragma warning(pop) } @@ -2162,13 +2158,13 @@ private: template result_type _Eval(_Engine& _Eng, const param_type& _Par0) const { using _Uty = make_unsigned_t<_Ty>; - constexpr auto _Ty_max{numeric_limits<_Ty>::max()}; - const auto _Ty1_max{_Trunc_to_float<_Ty1, _Uty>(static_cast<_Uty>(_Ty_max))}; + constexpr auto _Ty_max{(numeric_limits<_Ty>::max)()}; + const auto _Ty1_max{_Float_upper_bound<_Ty1, _Uty>(static_cast<_Uty>(_Ty_max))}; _Ty1 _Val; do { _Val = _CSTD log(_NRAND(_Eng, _Ty1)) / _Par0._Log_1_p; - } while (_Val > _Ty1_max); + } while (_Val >= _Ty1_max); return static_cast<_Ty>(_Val); } @@ -2334,15 +2330,15 @@ private: for (;;) { // generate and reject using _Uty = make_unsigned_t<_Ty>; - constexpr auto _Ty_max{numeric_limits<_Ty>::max()}; - const auto _Ty1_max{_Trunc_to_float<_Ty1, _Uty>(static_cast<_Uty>(_Ty_max))}; + constexpr auto _Ty_max{(numeric_limits<_Ty>::max)()}; + const auto _Ty1_max{_Float_upper_bound<_Ty1, _Uty>(static_cast<_Uty>(_Ty_max))}; _Ty _Res; _Ty1 _Yx; for (;;) { // generate a tentative value _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); const _Ty1 _Mx{_Par0._Sqrt * _Yx + _Par0._Mean}; - if (0.0 <= _Mx && _Mx <= _Ty1_max) { + if (0.0 <= _Mx && _Mx < _Ty1_max) { _Res = static_cast<_Ty>(_Mx); break; } @@ -2521,14 +2517,14 @@ private: _Res = _Par0._Small(_Eng); } else { // no shortcuts using _Uty = make_unsigned_t<_Ty>; - const auto _Ty1_Tx{_Trunc_to_float<_Ty1, _Uty>(static_cast<_Uty>(_Par0._Tx))}; + const auto _Ty1_Tx{_Float_upper_bound<_Ty1, _Uty>(static_cast<_Uty>(_Par0._Tx))}; for (;;) { // generate and reject _Ty1 _Yx; for (;;) { // generate a tentative value _Yx = static_cast<_Ty1>(_CSTD tan(_Pi * _NRAND(_Eng, _Ty1))); const _Ty1 _Mx{_Par0._Sqrt * _Yx + _Par0._Mean}; - if (0.0 <= _Mx && _Mx <= _Ty1_Tx) { + if (0.0 <= _Mx && _Mx < _Ty1_Tx) { _Res = static_cast<_Ty>(_Mx); break; } diff --git a/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp b/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp index 08db1d6645..dfba5d79cd 100644 --- a/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp +++ b/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp @@ -30,9 +30,9 @@ void Test_GH1001() { const double p1{1000.0 * p * std::pow(1.0 - p, static_cast(N - 1))}; const double mean{p * N}; - assert(mean_x / mean - 1.0 < 0.002); - assert(p0_x / p0 - 1.0 < 0.002); - assert(p1_x / p1 - 1.0 < 0.002); + assert(std::abs(mean_x / mean - 1.0) < 0.01); + assert(std::abs(p0_x / p0 - 1.0) < 0.01); + assert(std::abs(p1_x / p1 - 1.0) < 0.01); } int main() { diff --git a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp index f2f6a662be..75f24d50a4 100644 --- a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp +++ b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp @@ -8,23 +8,23 @@ template using lim = std::numeric_limits; template -void TruncAndCheck(T i, float fmax) { - const float x{std::_Trunc_to_float(i)}; - const float y{std::nextafter(x, lim::infinity())}; +void CheckUpperBound(T i, float fmax) { + const float x{std::_Float_upper_bound(i)}; + const float y{std::nextafter(x, 0.0f)}; // lower bound, <= i - assert(x < fmax); - assert(static_cast(x) <= i); - assert(y <= fmax); - if (y < fmax) - assert(static_cast(y) > i); + assert(y < fmax); + assert(static_cast(y) <= i); + assert(x <= fmax); + if (x < fmax) + assert(static_cast(x) > i); } template -void TestTruncExhaustive() { +void TestUpperBoundExhaustive() { const float fmax{exp2(static_cast(lim::digits))}; T i{0}; do { - TruncAndCheck(i, fmax); + CheckUpperBound(i, fmax); } while (++i != T{0}); } @@ -37,33 +37,33 @@ constexpr T FillLsb(int n) { } template -void TestTruncSelective() { +void TestUpperBoundSelective() { const float fmax{exp2(static_cast(lim::digits))}; - TruncAndCheck(T{0}, fmax); - TruncAndCheck(T{1}, fmax); - TruncAndCheck(lim::max(), fmax); + CheckUpperBound(T{0}, fmax); + CheckUpperBound(T{1}, fmax); + CheckUpperBound(lim::max(), fmax); // crossover from ulp < 1 to ulp = 1 constexpr T a{FillLsb(lim::digits - 1)}; - TruncAndCheck(a - 1, fmax); - TruncAndCheck(a, fmax); + CheckUpperBound(a - 1, fmax); + CheckUpperBound(a, fmax); // crossover from ulp = 1 to ulp > 1 constexpr T b{FillLsb(lim::digits)}; - TruncAndCheck(b, fmax); - TruncAndCheck(b + 1, fmax); - TruncAndCheck(b + 2, fmax); + CheckUpperBound(b, fmax); + CheckUpperBound(b + 1, fmax); + CheckUpperBound(b + 2, fmax); // saturation at the largest representable T constexpr int diff{lim::digits - lim::digits}; constexpr T c{FillLsb(lim::digits) << diff}; - TruncAndCheck(c - 1, fmax); - TruncAndCheck(c, fmax); - TruncAndCheck(c + 1, fmax); + CheckUpperBound(c - 1, fmax); + CheckUpperBound(c, fmax); + CheckUpperBound(c + 1, fmax); } int main() { - TestTruncExhaustive(); - TestTruncExhaustive(); - TestTruncSelective(); + TestUpperBoundExhaustive(); + TestUpperBoundExhaustive(); + TestUpperBoundSelective(); } From 831f65f084c686d39167053428b202d8efe40b0d Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Tue, 18 Aug 2020 16:42:16 -0700 Subject: [PATCH 07/13] buildfix - BSR for all integer widths - Need BSR operation for 64 bit types, even on x86. Borrowing _Bit_scan_reverse from charconv to xbit_ops.h to avoid duplication. --- stl/inc/charconv | 35 +---------------------------------- stl/inc/random | 7 ++++--- stl/inc/xbit_ops.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/stl/inc/charconv b/stl/inc/charconv index 905d5b00e5..9d67103055 100644 --- a/stl/inc/charconv +++ b/stl/inc/charconv @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -450,40 +451,6 @@ _NODISCARD inline _Big_integer_flt _Make_big_integer_flt_power_of_two(const uint return _Xval; } -_NODISCARD inline uint32_t _Bit_scan_reverse(const uint32_t _Value) noexcept { - unsigned long _Index; // Intentionally uninitialized for better codegen - - if (_BitScanReverse(&_Index, _Value)) { - return _Index + 1; - } - - return 0; -} - -_NODISCARD inline uint32_t _Bit_scan_reverse(const uint64_t _Value) noexcept { - unsigned long _Index; // Intentionally uninitialized for better codegen - -#ifdef _WIN64 - if (_BitScanReverse64(&_Index, _Value)) { - return _Index + 1; - } -#else // ^^^ 64-bit ^^^ / vvv 32-bit vvv - uint32_t _Ui32 = static_cast(_Value >> 32); - - if (_BitScanReverse(&_Index, _Ui32)) { - return _Index + 1 + 32; - } - - _Ui32 = static_cast(_Value); - - if (_BitScanReverse(&_Index, _Ui32)) { - return _Index + 1; - } -#endif // ^^^ 32-bit ^^^ - - return 0; -} - _NODISCARD inline uint32_t _Bit_scan_reverse(const _Big_integer_flt& _Xval) noexcept { if (_Xval._Myused == 0) { return 0; diff --git a/stl/inc/random b/stl/inc/random index d2bbb9565c..9afec9515d 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -8,13 +8,13 @@ #define _RANDOM_ #include -#include #if _STL_COMPILER_PREPROCESSOR #include #include #include #include #include +#include #include #pragma pack(push, _CRT_PACKING) @@ -2036,6 +2036,7 @@ template && is _NODISCARD inline _Flt _Float_upper_bound(_Ty _Val) { constexpr auto _Ty_digits = numeric_limits<_Ty>::digits; constexpr auto _Flt_digits = numeric_limits<_Flt>::digits; + using _Ty_32or64 = conditional_t<_Ty_digits <= 32, uint32_t, uint64_t>; if _CONSTEXPR_IF (_Ty_digits <= _Flt_digits) { return static_cast<_Flt>(_Val) + _Flt{1}; @@ -2044,8 +2045,8 @@ _NODISCARD inline _Flt _Float_upper_bound(_Ty _Val) { #pragma warning(disable : 4146) // unary minus of unsigned constexpr auto _Mask_shift = (_Ty_digits > _Flt_digits) ? _Ty_digits - _Flt_digits : 0; constexpr auto _Mask = _Ty(-1) << _Mask_shift; - const auto _Log = _Floor_of_log_2(_Val); - const auto _Shifted_mask = _Mask >> (_Ty_digits - 1 - _Log); + const auto _Log_plus1 = _Bit_scan_reverse(static_cast<_Ty_32or64>(_Val | _Ty{1})); + const auto _Shifted_mask = _Mask >> (_Ty_digits - _Log_plus1); const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; _Val &= _Shifted_mask; if (_Val == _Mask) { diff --git a/stl/inc/xbit_ops.h b/stl/inc/xbit_ops.h index 6f224585e1..45f6f1b042 100644 --- a/stl/inc/xbit_ops.h +++ b/stl/inc/xbit_ops.h @@ -51,6 +51,40 @@ _NODISCARD inline unsigned long _Ceiling_of_log_2(const size_t _Value) noexcept return 1 + _Floor_of_log_2(_Value - 1); } +_NODISCARD inline uint32_t _Bit_scan_reverse(const uint32_t _Value) noexcept { + unsigned long _Index; // Intentionally uninitialized for better codegen + + if (_BitScanReverse(&_Index, _Value)) { + return _Index + 1; + } + + return 0; +} + +_NODISCARD inline uint32_t _Bit_scan_reverse(const uint64_t _Value) noexcept { + unsigned long _Index; // Intentionally uninitialized for better codegen + +#ifdef _WIN64 + if (_BitScanReverse64(&_Index, _Value)) { + return _Index + 1; + } +#else // ^^^ 64-bit ^^^ / vvv 32-bit vvv + uint32_t _Ui32 = static_cast(_Value >> 32); + + if (_BitScanReverse(&_Index, _Ui32)) { + return _Index + 1 + 32; + } + + _Ui32 = static_cast(_Value); + + if (_BitScanReverse(&_Index, _Ui32)) { + return _Index + 1; + } +#endif // ^^^ 32-bit ^^^ + + return 0; +} + _STD_END #pragma pop_macro("new") From 1d8d74359f5c7fc6a56da1c04f4a5b490b5f7513 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Tue, 18 Aug 2020 16:56:22 -0700 Subject: [PATCH 08/13] Restore line endings from merge conflict --- tests/std/test.lst | 836 ++++++++++++++++++++++----------------------- 1 file changed, 418 insertions(+), 418 deletions(-) diff --git a/tests/std/test.lst b/tests/std/test.lst index 3078279467..40a239a6e4 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -1,418 +1,418 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -tests\Dev08_496675_iostream_int_reading -tests\Dev08_527068_scl_no_exceptions -tests\Dev08_563686_ostream -tests\Dev08_563705_std_malloc_free -tests\Dev08_576265_list_remove -tests\Dev08_584299_search_n -tests\Dev09_012361_vector_swap -tests\Dev09_052961_has_iterator_debugging_0 -tests\Dev09_056375_locale_cleanup -tests\Dev09_098637_stl_function_typeids -tests\Dev09_119637_throwing_string_with_hid0 -tests\Dev09_119644_compiler_option_gz -tests\Dev09_126254_persistent_aux_allocators -tests\Dev09_130060_unique_copy -tests\Dev09_152755_tr1_nested_bind -tests\Dev09_153419_tr1_allocators -tests\Dev09_154033_tr1_predicate_search_n -tests\Dev09_155328_tr1_vector_of_set -tests\Dev09_158181_tr1_unordered_meow_swap -tests\Dev09_158457_tr1_mem_fn_calling_conventions -tests\Dev09_161106_tr1_bind_templated_fxn_call_operator -tests\Dev09_165853_tr1_tuple_swap -tests\Dev09_171205_tr1_assign_pair_to_tuple -tests\Dev09_172497_tr1_mem_fn_const_correctness -tests\Dev09_172505_tr1_bind_reference_wrapper -tests\Dev09_172666_tr1_tuple_odr -tests\Dev09_173612_tr1_regex_leak -tests\Dev09_174589_tr1_function_storing_pmf_called_with_reference_or_pointer -tests\Dev09_175314_tr1_reference_wrapper_assignment -tests\Dev09_175716_tr1_dereferencing_reference_wrapper -tests\Dev09_176467_tr1_make_tuple_from_string_literal -tests\Dev09_176498_tr1_binding_functors_with_non_const_fxn_call_ops -tests\Dev09_181509_tr1_inf_loop_uniform_int_ull -tests\Dev09_182017_tr1_search_n -tests\Dev09_186118_stoullx_corner_cases -tests\Dev09_192736_tr1_prngs_not_copyconstructible -tests\Dev09_195561_tr1_function_const_op -tests\Dev09_196243_tr1_enable_shared_from_this_ops -tests\Dev09_199123_tr1_mem_fun_abstract_classes -tests\Dev10_391723_bind_result_type -tests\Dev10_414242_facet_bug_use_facet_ctype_char -tests\Dev10_441756_function_reference_wrapper -tests\Dev10_445289_make_shared -tests\Dev10_470547_facet_bug_stringstream -tests\Dev10_482830_header_only_string -tests\Dev10_491486_floating_point_hash -tests\Dev10_492345_tr1_function_swap -tests\Dev10_498944_enable_shared_from_this_auto_ptr -tests\Dev10_500860_overloaded_address_of -tests\Dev10_544258_heterogeneous_comparisons -tests\Dev10_555491_complex_linker_errors -tests\Dev10_561430_list_and_tree_leaks -tests\Dev10_562056_tree_leak -tests\Dev10_563443_empty_vector_begin_plus_zero -tests\Dev10_567556_move_from_empty_list -tests\Dev10_579381_vector_grow_to -tests\Dev10_590599_hash_string -tests\Dev10_609053_ctype_char_table_size -tests\Dev10_617014_tuple_tie -tests\Dev10_632876_regex_proxy -tests\Dev10_635436_shared_ptr_reset -tests\Dev10_639436_const_map_at -tests\Dev10_646244_bad_alloc_message -tests\Dev10_646556_construct_tuple_from_const -tests\Dev10_654977_655012_shared_ptr_move -tests\Dev10_661739_tuple_copy_ctors -tests\Dev10_682964_stable_sort_warnings -tests\Dev10_689595_back_inserter_vector_bool -tests\Dev10_709166_checked_and_unchecked_array_iterator -tests\Dev10_709168_marking_iterators_as_checked -tests\Dev10_722102_shared_ptr_nullptr -tests\Dev10_729003_bind_reference_wrapper -tests\Dev10_766948_insert_ambiguity -tests\Dev10_780098_movable_elements -tests\Dev10_783436_rvalue_string_plus -tests\Dev10_809142_copy_n_istream_iterator -tests\Dev10_814245_regex_character_class_crash -tests\Dev10_816787_swap_vector_bool_elements -tests\Dev10_847656_shared_ptr_is_convertible -tests\Dev10_851347_weak_ptr_virtual_inheritance -tests\Dev10_860410_bitset_ctors -tests\Dev10_860421_deque_push_back_pop_front -tests\Dev10_881629_vector_erase_return_value -tests\Dev10_904413_moved_from_function_should_be_empty -tests\Dev10_905461_is_sorted_until -tests\Dev10_908702_string_memory_leak -tests\Dev10_909646_stringstream_vd2 -tests\Dev11_0000000_dual_range_algorithms -tests\Dev11_0000000_function_crashes -tests\Dev11_0000000_include_each_header_alone -tests\Dev11_0000000_null_forward_iterators -tests\Dev11_0000000_quoted -tests\Dev11_0000000_rotate_test -tests\Dev11_0000000_tuple_cat -tests\Dev11_0000000_user_defined_literals -tests\Dev11_0019127_singular_iterators -tests\Dev11_0091392_string_erase_resize_perf -tests\Dev11_0133625_locale0_implib_cpp -tests\Dev11_0135139_vector_bool_equality_perf -tests\Dev11_0235721_async_and_packaged_task -tests\Dev11_0253803_debug_pointer -tests\Dev11_0272959_make_signed -tests\Dev11_0289403_partition_point_complexity -tests\Dev11_0299014_exception_ptr_requirements -tests\Dev11_0302476_pair_move -tests\Dev11_0314451_make_pair_make_tuple -tests\Dev11_0316853_find_memchr_optimization -tests\Dev11_0343056_pair_tuple_ctor_sfinae -tests\Dev11_0376122_grand_theft_bind -tests\Dev11_0377755_thread_ctor_move_only_types -tests\Dev11_0387701_container_equality -tests\Dev11_0417110_nullptr_t_is_scalar -tests\Dev11_0435439_call_once_deadlock -tests\Dev11_0437519_container_behavior -tests\Dev11_0437519_container_requirements -tests\Dev11_0447546_facet_allocation -tests\Dev11_0453373_codecvt_compiles -tests\Dev11_0483851_vector_debug_allocator_use -tests\Dev11_0485243_condition_variable_crash -tests\Dev11_0493504_error_category_lifetime -tests\Dev11_0494593_time_put_wchar_t -tests\Dev11_0496153_locale_ctor -tests\Dev11_0532622_minmax_element -tests\Dev11_0535636_functional_overhaul -tests\Dev11_0555154_system_clock_to_time_t -tests\Dev11_0577418_random_seed_0 -tests\Dev11_0579795_inplace_merge_out_of_memory -tests\Dev11_0607540_pair_tuple_rvalue_references -tests\Dev11_0617384_empty_std_function -tests\Dev11_0653897_codecvt_partial -tests\Dev11_0671816_list_splice -tests\Dev11_0696045_future_wait_for -tests\Dev11_0704582_ratio -tests\Dev11_0732166_unordered_strong_guarantee -tests\Dev11_0748972_function_crash_out_of_memory -tests\Dev11_0823534_transparent_lookup -tests\Dev11_0835323_to_string -tests\Dev11_0836436_get_time -tests\Dev11_0845312_comprehensive_floating_point -tests\Dev11_0863628_atomic_compare_exchange -tests\Dev11_0920385_list_sort_allocator -tests\Dev11_1003120_search_test -tests\Dev11_1066589_shared_ptr_atomic_deadlock -tests\Dev11_1066931_filesystem_rename_noop -tests\Dev11_1074023_constexpr -tests\Dev11_1086953_call_once_overhaul -tests\Dev11_1114006_condition_variable_pred -tests\Dev11_1127004_future_has_exceptions_0 -tests\Dev11_1131212_uncaught_exceptions -tests\Dev11_1137366_nested_exception -tests\Dev11_1140665_unique_ptr_array_conversions -tests\Dev11_1150223_shared_mutex -tests\Dev11_1158803_regex_thread_safety -tests\Dev11_1180290_filesystem_error_code -tests\GH_000457_system_error_message -tests\GH_000545_include_compare -tests\GH_000625_vector_bool_optimization -tests\GH_000685_condition_variable_any -tests\GH_000690_overaligned_function -tests\GH_000890_pow_template -tests\GH_000940_missing_valarray_copy -tests\GH_001001_random_rejection_rounding -tests\GH_001010_filesystem_error_encoding -tests\GH_001017_discrete_distribution_out_of_range -tests\GH_001086_partial_sort_copy -tests\GH_001103_countl_zero_correctness -tests\GH_001123_random_cast_out_of_range -tests\LWG2597_complex_branch_cut -tests\LWG3018_shared_ptr_function -tests\P0019R8_atomic_ref -tests\P0024R2_parallel_algorithms_adjacent_difference -tests\P0024R2_parallel_algorithms_adjacent_find -tests\P0024R2_parallel_algorithms_all_of -tests\P0024R2_parallel_algorithms_count -tests\P0024R2_parallel_algorithms_equal -tests\P0024R2_parallel_algorithms_exclusive_scan -tests\P0024R2_parallel_algorithms_find -tests\P0024R2_parallel_algorithms_find_end -tests\P0024R2_parallel_algorithms_find_first_of -tests\P0024R2_parallel_algorithms_for_each -tests\P0024R2_parallel_algorithms_inclusive_scan -tests\P0024R2_parallel_algorithms_is_heap -tests\P0024R2_parallel_algorithms_is_partitioned -tests\P0024R2_parallel_algorithms_is_sorted -tests\P0024R2_parallel_algorithms_mismatch -tests\P0024R2_parallel_algorithms_partition -tests\P0024R2_parallel_algorithms_reduce -tests\P0024R2_parallel_algorithms_remove -tests\P0024R2_parallel_algorithms_replace -tests\P0024R2_parallel_algorithms_search -tests\P0024R2_parallel_algorithms_search_n -tests\P0024R2_parallel_algorithms_set_difference -tests\P0024R2_parallel_algorithms_set_intersection -tests\P0024R2_parallel_algorithms_sort -tests\P0024R2_parallel_algorithms_stable_sort -tests\P0024R2_parallel_algorithms_transform -tests\P0024R2_parallel_algorithms_transform_exclusive_scan -tests\P0024R2_parallel_algorithms_transform_inclusive_scan -tests\P0024R2_parallel_algorithms_transform_reduce -tests\P0035R4_over_aligned_allocation -tests\P0040R3_extending_memory_management_tools -tests\P0067R5_charconv -tests\P0083R3_splicing_maps_and_sets -tests\P0088R3_variant -tests\P0092R1_polishing_chrono -tests\P0122R7_span -tests\P0122R7_span_death -tests\P0137R1_launder -tests\P0156R2_scoped_lock -tests\P0202R3_constexpr_algorithm_and_exchange -tests\P0218R1_filesystem -tests\P0220R1_any -tests\P0220R1_optional -tests\P0220R1_polymorphic_memory_resources -tests\P0220R1_sample -tests\P0220R1_searchers -tests\P0220R1_string_view -tests\P0325R4_to_array -tests\P0356R5_bind_front -tests\P0357R3_supporting_incomplete_types_in_reference_wrapper -tests\P0414R2_shared_ptr_for_arrays -tests\P0415R1_constexpr_complex -tests\P0426R1_constexpr_char_traits -tests\P0433R2_deduction_guides -tests\P0476R2_bit_cast -tests\P0487R1_fixing_operator_shl_basic_istream_char_pointer -tests\P0513R0_poisoning_the_hash -tests\P0528R3_cmpxchg_pad -tests\P0553R4_bit_rotating_and_counting_functions -tests\P0556R3_bit_integral_power_of_two_operations -tests\P0586R2_integer_comparison -tests\P0595R2_is_constant_evaluated -tests\P0607R0_inline_variables -tests\P0616R0_using_move_in_numeric -tests\P0631R8_numbers_math_constants -tests\P0674R1_make_shared_for_arrays -tests\P0718R2_atomic_smart_ptrs -tests\P0758R1_is_nothrow_convertible -tests\P0768R1_spaceship_operator -tests\P0769R2_shift_left_shift_right -tests\P0784R7_library_support_for_more_constexpr_containers -tests\P0811R3_midpoint_lerp -tests\P0896R4_counted_iterator -tests\P0896R4_counted_iterator_death -tests\P0896R4_P1614R2_comparisons -tests\P0896R4_ranges_alg_adjacent_find -tests\P0896R4_ranges_alg_all_of -tests\P0896R4_ranges_alg_any_of -tests\P0896R4_ranges_alg_binary_search -tests\P0896R4_ranges_alg_copy -tests\P0896R4_ranges_alg_copy_backward -tests\P0896R4_ranges_alg_copy_if -tests\P0896R4_ranges_alg_copy_n -tests\P0896R4_ranges_alg_count -tests\P0896R4_ranges_alg_count_if -tests\P0896R4_ranges_alg_equal -tests\P0896R4_ranges_alg_fill -tests\P0896R4_ranges_alg_fill_n -tests\P0896R4_ranges_alg_find -tests\P0896R4_ranges_alg_find_end -tests\P0896R4_ranges_alg_find_first_of -tests\P0896R4_ranges_alg_find_if -tests\P0896R4_ranges_alg_find_if_not -tests\P0896R4_ranges_alg_for_each -tests\P0896R4_ranges_alg_for_each_n -tests\P0896R4_ranges_alg_generate -tests\P0896R4_ranges_alg_generate_n -tests\P0896R4_ranges_alg_heap -tests\P0896R4_ranges_alg_includes -tests\P0896R4_ranges_alg_is_permutation -tests\P0896R4_ranges_alg_is_sorted -tests\P0896R4_ranges_alg_lexicographical_compare -tests\P0896R4_ranges_alg_merge -tests\P0896R4_ranges_alg_minmax -tests\P0896R4_ranges_alg_mismatch -tests\P0896R4_ranges_alg_move -tests\P0896R4_ranges_alg_move_backward -tests\P0896R4_ranges_alg_none_of -tests\P0896R4_ranges_alg_nth_element -tests\P0896R4_ranges_alg_partition -tests\P0896R4_ranges_alg_partition_copy -tests\P0896R4_ranges_alg_partition_point -tests\P0896R4_ranges_alg_permutations -tests\P0896R4_ranges_alg_remove -tests\P0896R4_ranges_alg_remove_copy -tests\P0896R4_ranges_alg_remove_copy_if -tests\P0896R4_ranges_alg_remove_if -tests\P0896R4_ranges_alg_replace -tests\P0896R4_ranges_alg_replace_copy -tests\P0896R4_ranges_alg_replace_copy_if -tests\P0896R4_ranges_alg_replace_if -tests\P0896R4_ranges_alg_reverse -tests\P0896R4_ranges_alg_reverse_copy -tests\P0896R4_ranges_alg_rotate -tests\P0896R4_ranges_alg_rotate_copy -tests\P0896R4_ranges_alg_sample -tests\P0896R4_ranges_alg_search -tests\P0896R4_ranges_alg_search_n -tests\P0896R4_ranges_alg_set_difference -tests\P0896R4_ranges_alg_set_intersection -tests\P0896R4_ranges_alg_set_symmetric_difference -tests\P0896R4_ranges_alg_set_union -tests\P0896R4_ranges_alg_shuffle -tests\P0896R4_ranges_alg_sort -tests\P0896R4_ranges_alg_swap_ranges -tests\P0896R4_ranges_alg_transform_binary -tests\P0896R4_ranges_alg_transform_unary -tests\P0896R4_ranges_alg_uninitialized_move -tests\P0896R4_ranges_alg_unique -tests\P0896R4_ranges_alg_unique_copy -tests\P0896R4_ranges_algorithm_machinery -tests\P0896R4_ranges_iterator_machinery -tests\P0896R4_ranges_range_machinery -tests\P0896R4_ranges_subrange -tests\P0896R4_ranges_test_machinery -tests\P0896R4_ranges_to_address -tests\P0898R3_concepts -tests\P0898R3_identity -tests\P0919R3_heterogeneous_unordered_lookup -tests\P0966R1_string_reserve_should_not_shrink -tests\P1023R0_constexpr_for_array_comparisons -tests\P1032R1_miscellaneous_constexpr -tests\P1135R6_atomic_flag_test -tests\P1135R6_atomic_wait -tests\P1135R6_atomic_wait_vista -tests\P1165R1_consistently_propagating_stateful_allocators -tests\P1423R3_char8_t_remediation -tests\P1645R1_constexpr_numeric -tests\VSO_0000000_allocator_propagation -tests\VSO_0000000_any_calling_conventions -tests\VSO_0000000_c_math_functions -tests\VSO_0000000_condition_variable_any_exceptions -tests\VSO_0000000_container_allocator_constructors -tests\VSO_0000000_exception_ptr_rethrow_seh -tests\VSO_0000000_fancy_pointers -tests\VSO_0000000_has_static_rtti -tests\VSO_0000000_initialize_everything -tests\VSO_0000000_instantiate_algorithms_16_difference_type_1 -tests\VSO_0000000_instantiate_algorithms_16_difference_type_2 -tests\VSO_0000000_instantiate_algorithms_32_difference_type_1 -tests\VSO_0000000_instantiate_algorithms_32_difference_type_2 -tests\VSO_0000000_instantiate_algorithms_64_difference_type_1 -tests\VSO_0000000_instantiate_algorithms_64_difference_type_2 -tests\VSO_0000000_instantiate_algorithms_int_1 -tests\VSO_0000000_instantiate_algorithms_int_2 -tests\VSO_0000000_instantiate_algorithms_nontrivial_1 -tests\VSO_0000000_instantiate_algorithms_nontrivial_2 -tests\VSO_0000000_instantiate_containers -tests\VSO_0000000_instantiate_cvt -tests\VSO_0000000_instantiate_iterators_misc -tests\VSO_0000000_instantiate_type_traits -tests\VSO_0000000_list_iterator_debugging -tests\VSO_0000000_list_unique_self_reference -tests\VSO_0000000_matching_npos_address -tests\VSO_0000000_more_pair_tuple_sfinae -tests\VSO_0000000_nullptr_stream_out -tests\VSO_0000000_oss_workarounds -tests\VSO_0000000_path_stream_parameter -tests\VSO_0000000_regex_interface -tests\VSO_0000000_regex_use -tests\VSO_0000000_strengthened_noexcept -tests\VSO_0000000_string_view_idl -tests\VSO_0000000_type_traits -tests\VSO_0000000_vector_algorithms -tests\VSO_0000000_wcfb01_idempotent_container_destructors -tests\VSO_0000000_wchar_t_filebuf_xsmeown -tests\VSO_0095468_clr_exception_ptr_bad_alloc -tests\VSO_0095837_current_exception_dtor -tests\VSO_0099869_pow_float_overflow -tests\VSO_0102478_moving_allocators -tests\VSO_0104705_throwing_copy_in_current_exception -tests\VSO_0104705_throwing_copy_in_current_exception_seh -tests\VSO_0105317_expression_sfinae -tests\VSO_0118461_min_max_noexcept -tests\VSO_0121275_filesystem_canonical_should_handle_many_double_dots -tests\VSO_0121440_is_iterator_iterator_traits -tests\VSO_0131167_associative_emplacement_allocations -tests\VSO_0135428_custom_char_traits_string -tests\VSO_0144114_sleep_until -tests\VSO_0144294_unordered_map_max_bucket_count -tests\VSO_0149983_system_error_broken_pipe -tests\VSO_0157762_feature_test_macros -tests\VSO_0174871_string_replace -tests\VSO_0180466_algorithm_overhauls -tests\VSO_0180469_fill_family -tests\VSO_0180469_ptr_cat -tests\VSO_0191296_allocator_construct -tests\VSO_0204655_heap_algorithms_integer_overflow -tests\VSO_0224478_scoped_allocator -tests\VSO_0226079_mutex -tests\VSO_0234888_num_get_overflows -tests\VSO_0299624_checked_array_iterator_idl -tests\VSO_0397980_codecvt_length -tests\VSO_0429900_fast_debug_range_based_for -tests\VSO_0474901_shift_jis_codecvt -tests\VSO_0493909_is_aggregate -tests\VSO_0512710_terminate_current_exception_from_noexcept_function -tests\VSO_0512710_terminate_current_exception_from_noexcept_function_2 -tests\VSO_0512710_terminate_current_exception_from_unwind -tests\VSO_0527559_pragma_managed -tests\VSO_0575109_string_ambiguous_overloads -tests\VSO_0599804_seekg_zero -tests\VSO_0644691_utf_8_codecvt -tests\VSO_0663136_string_includes_cctype -tests\VSO_0664587_lcg_divide_by_zero -tests\VSO_0677157_flist_merge_edge_cases -tests\VSO_0735700_fstream_read_over_4k -tests\VSO_0736657_unordered_assign_rehash -tests\VSO_0744055_atomic_load_8_bytes_readonly -tests\VSO_0792651_unordered_set_rehash_invalidates_key -tests\VSO_0830211_container_debugging_range_checks -tests\VSO_0849827_multicontainer_emplace_hint_position -tests\VSO_0938757_attribute_order -tests\VSO_0961751_hash_range_erase -tests\VSO_0971246_legacy_await_headers +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +tests\Dev08_496675_iostream_int_reading +tests\Dev08_527068_scl_no_exceptions +tests\Dev08_563686_ostream +tests\Dev08_563705_std_malloc_free +tests\Dev08_576265_list_remove +tests\Dev08_584299_search_n +tests\Dev09_012361_vector_swap +tests\Dev09_052961_has_iterator_debugging_0 +tests\Dev09_056375_locale_cleanup +tests\Dev09_098637_stl_function_typeids +tests\Dev09_119637_throwing_string_with_hid0 +tests\Dev09_119644_compiler_option_gz +tests\Dev09_126254_persistent_aux_allocators +tests\Dev09_130060_unique_copy +tests\Dev09_152755_tr1_nested_bind +tests\Dev09_153419_tr1_allocators +tests\Dev09_154033_tr1_predicate_search_n +tests\Dev09_155328_tr1_vector_of_set +tests\Dev09_158181_tr1_unordered_meow_swap +tests\Dev09_158457_tr1_mem_fn_calling_conventions +tests\Dev09_161106_tr1_bind_templated_fxn_call_operator +tests\Dev09_165853_tr1_tuple_swap +tests\Dev09_171205_tr1_assign_pair_to_tuple +tests\Dev09_172497_tr1_mem_fn_const_correctness +tests\Dev09_172505_tr1_bind_reference_wrapper +tests\Dev09_172666_tr1_tuple_odr +tests\Dev09_173612_tr1_regex_leak +tests\Dev09_174589_tr1_function_storing_pmf_called_with_reference_or_pointer +tests\Dev09_175314_tr1_reference_wrapper_assignment +tests\Dev09_175716_tr1_dereferencing_reference_wrapper +tests\Dev09_176467_tr1_make_tuple_from_string_literal +tests\Dev09_176498_tr1_binding_functors_with_non_const_fxn_call_ops +tests\Dev09_181509_tr1_inf_loop_uniform_int_ull +tests\Dev09_182017_tr1_search_n +tests\Dev09_186118_stoullx_corner_cases +tests\Dev09_192736_tr1_prngs_not_copyconstructible +tests\Dev09_195561_tr1_function_const_op +tests\Dev09_196243_tr1_enable_shared_from_this_ops +tests\Dev09_199123_tr1_mem_fun_abstract_classes +tests\Dev10_391723_bind_result_type +tests\Dev10_414242_facet_bug_use_facet_ctype_char +tests\Dev10_441756_function_reference_wrapper +tests\Dev10_445289_make_shared +tests\Dev10_470547_facet_bug_stringstream +tests\Dev10_482830_header_only_string +tests\Dev10_491486_floating_point_hash +tests\Dev10_492345_tr1_function_swap +tests\Dev10_498944_enable_shared_from_this_auto_ptr +tests\Dev10_500860_overloaded_address_of +tests\Dev10_544258_heterogeneous_comparisons +tests\Dev10_555491_complex_linker_errors +tests\Dev10_561430_list_and_tree_leaks +tests\Dev10_562056_tree_leak +tests\Dev10_563443_empty_vector_begin_plus_zero +tests\Dev10_567556_move_from_empty_list +tests\Dev10_579381_vector_grow_to +tests\Dev10_590599_hash_string +tests\Dev10_609053_ctype_char_table_size +tests\Dev10_617014_tuple_tie +tests\Dev10_632876_regex_proxy +tests\Dev10_635436_shared_ptr_reset +tests\Dev10_639436_const_map_at +tests\Dev10_646244_bad_alloc_message +tests\Dev10_646556_construct_tuple_from_const +tests\Dev10_654977_655012_shared_ptr_move +tests\Dev10_661739_tuple_copy_ctors +tests\Dev10_682964_stable_sort_warnings +tests\Dev10_689595_back_inserter_vector_bool +tests\Dev10_709166_checked_and_unchecked_array_iterator +tests\Dev10_709168_marking_iterators_as_checked +tests\Dev10_722102_shared_ptr_nullptr +tests\Dev10_729003_bind_reference_wrapper +tests\Dev10_766948_insert_ambiguity +tests\Dev10_780098_movable_elements +tests\Dev10_783436_rvalue_string_plus +tests\Dev10_809142_copy_n_istream_iterator +tests\Dev10_814245_regex_character_class_crash +tests\Dev10_816787_swap_vector_bool_elements +tests\Dev10_847656_shared_ptr_is_convertible +tests\Dev10_851347_weak_ptr_virtual_inheritance +tests\Dev10_860410_bitset_ctors +tests\Dev10_860421_deque_push_back_pop_front +tests\Dev10_881629_vector_erase_return_value +tests\Dev10_904413_moved_from_function_should_be_empty +tests\Dev10_905461_is_sorted_until +tests\Dev10_908702_string_memory_leak +tests\Dev10_909646_stringstream_vd2 +tests\Dev11_0000000_dual_range_algorithms +tests\Dev11_0000000_function_crashes +tests\Dev11_0000000_include_each_header_alone +tests\Dev11_0000000_null_forward_iterators +tests\Dev11_0000000_quoted +tests\Dev11_0000000_rotate_test +tests\Dev11_0000000_tuple_cat +tests\Dev11_0000000_user_defined_literals +tests\Dev11_0019127_singular_iterators +tests\Dev11_0091392_string_erase_resize_perf +tests\Dev11_0133625_locale0_implib_cpp +tests\Dev11_0135139_vector_bool_equality_perf +tests\Dev11_0235721_async_and_packaged_task +tests\Dev11_0253803_debug_pointer +tests\Dev11_0272959_make_signed +tests\Dev11_0289403_partition_point_complexity +tests\Dev11_0299014_exception_ptr_requirements +tests\Dev11_0302476_pair_move +tests\Dev11_0314451_make_pair_make_tuple +tests\Dev11_0316853_find_memchr_optimization +tests\Dev11_0343056_pair_tuple_ctor_sfinae +tests\Dev11_0376122_grand_theft_bind +tests\Dev11_0377755_thread_ctor_move_only_types +tests\Dev11_0387701_container_equality +tests\Dev11_0417110_nullptr_t_is_scalar +tests\Dev11_0435439_call_once_deadlock +tests\Dev11_0437519_container_behavior +tests\Dev11_0437519_container_requirements +tests\Dev11_0447546_facet_allocation +tests\Dev11_0453373_codecvt_compiles +tests\Dev11_0483851_vector_debug_allocator_use +tests\Dev11_0485243_condition_variable_crash +tests\Dev11_0493504_error_category_lifetime +tests\Dev11_0494593_time_put_wchar_t +tests\Dev11_0496153_locale_ctor +tests\Dev11_0532622_minmax_element +tests\Dev11_0535636_functional_overhaul +tests\Dev11_0555154_system_clock_to_time_t +tests\Dev11_0577418_random_seed_0 +tests\Dev11_0579795_inplace_merge_out_of_memory +tests\Dev11_0607540_pair_tuple_rvalue_references +tests\Dev11_0617384_empty_std_function +tests\Dev11_0653897_codecvt_partial +tests\Dev11_0671816_list_splice +tests\Dev11_0696045_future_wait_for +tests\Dev11_0704582_ratio +tests\Dev11_0732166_unordered_strong_guarantee +tests\Dev11_0748972_function_crash_out_of_memory +tests\Dev11_0823534_transparent_lookup +tests\Dev11_0835323_to_string +tests\Dev11_0836436_get_time +tests\Dev11_0845312_comprehensive_floating_point +tests\Dev11_0863628_atomic_compare_exchange +tests\Dev11_0920385_list_sort_allocator +tests\Dev11_1003120_search_test +tests\Dev11_1066589_shared_ptr_atomic_deadlock +tests\Dev11_1066931_filesystem_rename_noop +tests\Dev11_1074023_constexpr +tests\Dev11_1086953_call_once_overhaul +tests\Dev11_1114006_condition_variable_pred +tests\Dev11_1127004_future_has_exceptions_0 +tests\Dev11_1131212_uncaught_exceptions +tests\Dev11_1137366_nested_exception +tests\Dev11_1140665_unique_ptr_array_conversions +tests\Dev11_1150223_shared_mutex +tests\Dev11_1158803_regex_thread_safety +tests\Dev11_1180290_filesystem_error_code +tests\GH_000457_system_error_message +tests\GH_000545_include_compare +tests\GH_000625_vector_bool_optimization +tests\GH_000685_condition_variable_any +tests\GH_000690_overaligned_function +tests\GH_000890_pow_template +tests\GH_000940_missing_valarray_copy +tests\GH_001001_random_rejection_rounding +tests\GH_001010_filesystem_error_encoding +tests\GH_001017_discrete_distribution_out_of_range +tests\GH_001086_partial_sort_copy +tests\GH_001103_countl_zero_correctness +tests\GH_001123_random_cast_out_of_range +tests\LWG2597_complex_branch_cut +tests\LWG3018_shared_ptr_function +tests\P0019R8_atomic_ref +tests\P0024R2_parallel_algorithms_adjacent_difference +tests\P0024R2_parallel_algorithms_adjacent_find +tests\P0024R2_parallel_algorithms_all_of +tests\P0024R2_parallel_algorithms_count +tests\P0024R2_parallel_algorithms_equal +tests\P0024R2_parallel_algorithms_exclusive_scan +tests\P0024R2_parallel_algorithms_find +tests\P0024R2_parallel_algorithms_find_end +tests\P0024R2_parallel_algorithms_find_first_of +tests\P0024R2_parallel_algorithms_for_each +tests\P0024R2_parallel_algorithms_inclusive_scan +tests\P0024R2_parallel_algorithms_is_heap +tests\P0024R2_parallel_algorithms_is_partitioned +tests\P0024R2_parallel_algorithms_is_sorted +tests\P0024R2_parallel_algorithms_mismatch +tests\P0024R2_parallel_algorithms_partition +tests\P0024R2_parallel_algorithms_reduce +tests\P0024R2_parallel_algorithms_remove +tests\P0024R2_parallel_algorithms_replace +tests\P0024R2_parallel_algorithms_search +tests\P0024R2_parallel_algorithms_search_n +tests\P0024R2_parallel_algorithms_set_difference +tests\P0024R2_parallel_algorithms_set_intersection +tests\P0024R2_parallel_algorithms_sort +tests\P0024R2_parallel_algorithms_stable_sort +tests\P0024R2_parallel_algorithms_transform +tests\P0024R2_parallel_algorithms_transform_exclusive_scan +tests\P0024R2_parallel_algorithms_transform_inclusive_scan +tests\P0024R2_parallel_algorithms_transform_reduce +tests\P0035R4_over_aligned_allocation +tests\P0040R3_extending_memory_management_tools +tests\P0067R5_charconv +tests\P0083R3_splicing_maps_and_sets +tests\P0088R3_variant +tests\P0092R1_polishing_chrono +tests\P0122R7_span +tests\P0122R7_span_death +tests\P0137R1_launder +tests\P0156R2_scoped_lock +tests\P0202R3_constexpr_algorithm_and_exchange +tests\P0218R1_filesystem +tests\P0220R1_any +tests\P0220R1_optional +tests\P0220R1_polymorphic_memory_resources +tests\P0220R1_sample +tests\P0220R1_searchers +tests\P0220R1_string_view +tests\P0325R4_to_array +tests\P0356R5_bind_front +tests\P0357R3_supporting_incomplete_types_in_reference_wrapper +tests\P0414R2_shared_ptr_for_arrays +tests\P0415R1_constexpr_complex +tests\P0426R1_constexpr_char_traits +tests\P0433R2_deduction_guides +tests\P0476R2_bit_cast +tests\P0487R1_fixing_operator_shl_basic_istream_char_pointer +tests\P0513R0_poisoning_the_hash +tests\P0528R3_cmpxchg_pad +tests\P0553R4_bit_rotating_and_counting_functions +tests\P0556R3_bit_integral_power_of_two_operations +tests\P0586R2_integer_comparison +tests\P0595R2_is_constant_evaluated +tests\P0607R0_inline_variables +tests\P0616R0_using_move_in_numeric +tests\P0631R8_numbers_math_constants +tests\P0674R1_make_shared_for_arrays +tests\P0718R2_atomic_smart_ptrs +tests\P0758R1_is_nothrow_convertible +tests\P0768R1_spaceship_operator +tests\P0769R2_shift_left_shift_right +tests\P0784R7_library_support_for_more_constexpr_containers +tests\P0811R3_midpoint_lerp +tests\P0896R4_counted_iterator +tests\P0896R4_counted_iterator_death +tests\P0896R4_P1614R2_comparisons +tests\P0896R4_ranges_alg_adjacent_find +tests\P0896R4_ranges_alg_all_of +tests\P0896R4_ranges_alg_any_of +tests\P0896R4_ranges_alg_binary_search +tests\P0896R4_ranges_alg_copy +tests\P0896R4_ranges_alg_copy_backward +tests\P0896R4_ranges_alg_copy_if +tests\P0896R4_ranges_alg_copy_n +tests\P0896R4_ranges_alg_count +tests\P0896R4_ranges_alg_count_if +tests\P0896R4_ranges_alg_equal +tests\P0896R4_ranges_alg_fill +tests\P0896R4_ranges_alg_fill_n +tests\P0896R4_ranges_alg_find +tests\P0896R4_ranges_alg_find_end +tests\P0896R4_ranges_alg_find_first_of +tests\P0896R4_ranges_alg_find_if +tests\P0896R4_ranges_alg_find_if_not +tests\P0896R4_ranges_alg_for_each +tests\P0896R4_ranges_alg_for_each_n +tests\P0896R4_ranges_alg_generate +tests\P0896R4_ranges_alg_generate_n +tests\P0896R4_ranges_alg_heap +tests\P0896R4_ranges_alg_includes +tests\P0896R4_ranges_alg_is_permutation +tests\P0896R4_ranges_alg_is_sorted +tests\P0896R4_ranges_alg_lexicographical_compare +tests\P0896R4_ranges_alg_merge +tests\P0896R4_ranges_alg_minmax +tests\P0896R4_ranges_alg_mismatch +tests\P0896R4_ranges_alg_move +tests\P0896R4_ranges_alg_move_backward +tests\P0896R4_ranges_alg_none_of +tests\P0896R4_ranges_alg_nth_element +tests\P0896R4_ranges_alg_partition +tests\P0896R4_ranges_alg_partition_copy +tests\P0896R4_ranges_alg_partition_point +tests\P0896R4_ranges_alg_permutations +tests\P0896R4_ranges_alg_remove +tests\P0896R4_ranges_alg_remove_copy +tests\P0896R4_ranges_alg_remove_copy_if +tests\P0896R4_ranges_alg_remove_if +tests\P0896R4_ranges_alg_replace +tests\P0896R4_ranges_alg_replace_copy +tests\P0896R4_ranges_alg_replace_copy_if +tests\P0896R4_ranges_alg_replace_if +tests\P0896R4_ranges_alg_reverse +tests\P0896R4_ranges_alg_reverse_copy +tests\P0896R4_ranges_alg_rotate +tests\P0896R4_ranges_alg_rotate_copy +tests\P0896R4_ranges_alg_sample +tests\P0896R4_ranges_alg_search +tests\P0896R4_ranges_alg_search_n +tests\P0896R4_ranges_alg_set_difference +tests\P0896R4_ranges_alg_set_intersection +tests\P0896R4_ranges_alg_set_symmetric_difference +tests\P0896R4_ranges_alg_set_union +tests\P0896R4_ranges_alg_shuffle +tests\P0896R4_ranges_alg_sort +tests\P0896R4_ranges_alg_swap_ranges +tests\P0896R4_ranges_alg_transform_binary +tests\P0896R4_ranges_alg_transform_unary +tests\P0896R4_ranges_alg_uninitialized_move +tests\P0896R4_ranges_alg_unique +tests\P0896R4_ranges_alg_unique_copy +tests\P0896R4_ranges_algorithm_machinery +tests\P0896R4_ranges_iterator_machinery +tests\P0896R4_ranges_range_machinery +tests\P0896R4_ranges_subrange +tests\P0896R4_ranges_test_machinery +tests\P0896R4_ranges_to_address +tests\P0898R3_concepts +tests\P0898R3_identity +tests\P0919R3_heterogeneous_unordered_lookup +tests\P0966R1_string_reserve_should_not_shrink +tests\P1023R0_constexpr_for_array_comparisons +tests\P1032R1_miscellaneous_constexpr +tests\P1135R6_atomic_flag_test +tests\P1135R6_atomic_wait +tests\P1135R6_atomic_wait_vista +tests\P1165R1_consistently_propagating_stateful_allocators +tests\P1423R3_char8_t_remediation +tests\P1645R1_constexpr_numeric +tests\VSO_0000000_allocator_propagation +tests\VSO_0000000_any_calling_conventions +tests\VSO_0000000_c_math_functions +tests\VSO_0000000_condition_variable_any_exceptions +tests\VSO_0000000_container_allocator_constructors +tests\VSO_0000000_exception_ptr_rethrow_seh +tests\VSO_0000000_fancy_pointers +tests\VSO_0000000_has_static_rtti +tests\VSO_0000000_initialize_everything +tests\VSO_0000000_instantiate_algorithms_16_difference_type_1 +tests\VSO_0000000_instantiate_algorithms_16_difference_type_2 +tests\VSO_0000000_instantiate_algorithms_32_difference_type_1 +tests\VSO_0000000_instantiate_algorithms_32_difference_type_2 +tests\VSO_0000000_instantiate_algorithms_64_difference_type_1 +tests\VSO_0000000_instantiate_algorithms_64_difference_type_2 +tests\VSO_0000000_instantiate_algorithms_int_1 +tests\VSO_0000000_instantiate_algorithms_int_2 +tests\VSO_0000000_instantiate_algorithms_nontrivial_1 +tests\VSO_0000000_instantiate_algorithms_nontrivial_2 +tests\VSO_0000000_instantiate_containers +tests\VSO_0000000_instantiate_cvt +tests\VSO_0000000_instantiate_iterators_misc +tests\VSO_0000000_instantiate_type_traits +tests\VSO_0000000_list_iterator_debugging +tests\VSO_0000000_list_unique_self_reference +tests\VSO_0000000_matching_npos_address +tests\VSO_0000000_more_pair_tuple_sfinae +tests\VSO_0000000_nullptr_stream_out +tests\VSO_0000000_oss_workarounds +tests\VSO_0000000_path_stream_parameter +tests\VSO_0000000_regex_interface +tests\VSO_0000000_regex_use +tests\VSO_0000000_strengthened_noexcept +tests\VSO_0000000_string_view_idl +tests\VSO_0000000_type_traits +tests\VSO_0000000_vector_algorithms +tests\VSO_0000000_wcfb01_idempotent_container_destructors +tests\VSO_0000000_wchar_t_filebuf_xsmeown +tests\VSO_0095468_clr_exception_ptr_bad_alloc +tests\VSO_0095837_current_exception_dtor +tests\VSO_0099869_pow_float_overflow +tests\VSO_0102478_moving_allocators +tests\VSO_0104705_throwing_copy_in_current_exception +tests\VSO_0104705_throwing_copy_in_current_exception_seh +tests\VSO_0105317_expression_sfinae +tests\VSO_0118461_min_max_noexcept +tests\VSO_0121275_filesystem_canonical_should_handle_many_double_dots +tests\VSO_0121440_is_iterator_iterator_traits +tests\VSO_0131167_associative_emplacement_allocations +tests\VSO_0135428_custom_char_traits_string +tests\VSO_0144114_sleep_until +tests\VSO_0144294_unordered_map_max_bucket_count +tests\VSO_0149983_system_error_broken_pipe +tests\VSO_0157762_feature_test_macros +tests\VSO_0174871_string_replace +tests\VSO_0180466_algorithm_overhauls +tests\VSO_0180469_fill_family +tests\VSO_0180469_ptr_cat +tests\VSO_0191296_allocator_construct +tests\VSO_0204655_heap_algorithms_integer_overflow +tests\VSO_0224478_scoped_allocator +tests\VSO_0226079_mutex +tests\VSO_0234888_num_get_overflows +tests\VSO_0299624_checked_array_iterator_idl +tests\VSO_0397980_codecvt_length +tests\VSO_0429900_fast_debug_range_based_for +tests\VSO_0474901_shift_jis_codecvt +tests\VSO_0493909_is_aggregate +tests\VSO_0512710_terminate_current_exception_from_noexcept_function +tests\VSO_0512710_terminate_current_exception_from_noexcept_function_2 +tests\VSO_0512710_terminate_current_exception_from_unwind +tests\VSO_0527559_pragma_managed +tests\VSO_0575109_string_ambiguous_overloads +tests\VSO_0599804_seekg_zero +tests\VSO_0644691_utf_8_codecvt +tests\VSO_0663136_string_includes_cctype +tests\VSO_0664587_lcg_divide_by_zero +tests\VSO_0677157_flist_merge_edge_cases +tests\VSO_0735700_fstream_read_over_4k +tests\VSO_0736657_unordered_assign_rehash +tests\VSO_0744055_atomic_load_8_bytes_readonly +tests\VSO_0792651_unordered_set_rehash_invalidates_key +tests\VSO_0830211_container_debugging_range_checks +tests\VSO_0849827_multicontainer_emplace_hint_position +tests\VSO_0938757_attribute_order +tests\VSO_0961751_hash_range_erase +tests\VSO_0971246_legacy_await_headers From b260904095158cb7c6572f5e6f5065cb19bc56b6 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Thu, 20 Aug 2020 17:07:53 -0700 Subject: [PATCH 09/13] buildfix --- stl/inc/xbit_ops.h | 1 + 1 file changed, 1 insertion(+) diff --git a/stl/inc/xbit_ops.h b/stl/inc/xbit_ops.h index 45f6f1b042..ca2aaa37e3 100644 --- a/stl/inc/xbit_ops.h +++ b/stl/inc/xbit_ops.h @@ -9,6 +9,7 @@ #include #if _STL_COMPILER_PREPROCESSOR +#include #include #pragma pack(push, _CRT_PACKING) From f6d395aff36298bc75e43d5673e4b915d1fca1c2 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Fri, 21 Aug 2020 08:19:56 -0700 Subject: [PATCH 10/13] Apply suggestions from code review --- stl/inc/random | 11 ++++++----- .../test.cpp | 17 ++++++++++------- .../GH_001123_random_cast_out_of_range/test.cpp | 11 ++++++++--- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index 9afec9515d..a2ad738580 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2029,11 +2029,12 @@ basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, // FUNCTION TEMPLATE _Float_upper_bound -// Returns smallest _Flt s.t. static_cast<_Ty>(_Result) > _Val. First -// truncate to largest _Flt <= _Val, then add ceil(ulp) +// Returns smallest _Flt such that static_cast<_Ty>(_Result) > _Val. +// First truncate to largest _Flt <= _Val, then add ceil(ulp). -template && is_floating_point_v<_Flt>>> -_NODISCARD inline _Flt _Float_upper_bound(_Ty _Val) { +template +_NODISCARD _Flt _Float_upper_bound(_Ty _Val) { + static_assert(is_unsigned_v<_Ty> && is_floating_point_v<_Flt>, "invalid template argument for _Float_upper_bound"); constexpr auto _Ty_digits = numeric_limits<_Ty>::digits; constexpr auto _Flt_digits = numeric_limits<_Flt>::digits; using _Ty_32or64 = conditional_t<_Ty_digits <= 32, uint32_t, uint64_t>; @@ -2160,7 +2161,7 @@ private: result_type _Eval(_Engine& _Eng, const param_type& _Par0) const { using _Uty = make_unsigned_t<_Ty>; constexpr auto _Ty_max{(numeric_limits<_Ty>::max)()}; - const auto _Ty1_max{_Float_upper_bound<_Ty1, _Uty>(static_cast<_Uty>(_Ty_max))}; + const auto _Ty1_max{_Float_upper_bound<_Ty1>(static_cast<_Uty>(_Ty_max))}; _Ty1 _Val; do { diff --git a/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp b/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp index dfba5d79cd..fc0c792b13 100644 --- a/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp +++ b/tests/std/tests/GH_001001_random_rejection_rounding/test.cpp @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + #include #include #include @@ -9,22 +12,22 @@ void Test_GH1001() { constexpr double p{.001238}; constexpr int seed{12345}; constexpr int iters{1'000'000}; - std::map count; + std::map frequency; std::mt19937 mt_rand(seed); std::binomial_distribution distribution(N, p); - for (int i = 0; i < iters; i++) { - ++count[distribution(mt_rand)]; + for (int i = 0; i < iters; ++i) { + ++frequency[distribution(mt_rand)]; } double mean_x{0.0}; - for (auto pair : count) { - mean_x += pair.first * static_cast(pair.second) / iters; + for (const auto& valueCountPair : frequency) { + mean_x += valueCountPair.first * static_cast(valueCountPair.second) / iters; } - const double p0_x{static_cast(count[0]) / iters}; - const double p1_x{static_cast(count[1]) / iters}; + const double p0_x{static_cast(frequency[0]) / iters}; + const double p1_x{static_cast(frequency[1]) / iters}; const double p0{std::pow(1.0 - p, static_cast(N))}; const double p1{1000.0 * p * std::pow(1.0 - p, static_cast(N - 1))}; diff --git a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp index 75f24d50a4..d58b36b214 100644 --- a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp +++ b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + #include #include #include @@ -9,14 +12,15 @@ using lim = std::numeric_limits; template void CheckUpperBound(T i, float fmax) { - const float x{std::_Float_upper_bound(i)}; + const float x{std::_Float_upper_bound(i)}; const float y{std::nextafter(x, 0.0f)}; // lower bound, <= i assert(y < fmax); assert(static_cast(y) <= i); assert(x <= fmax); - if (x < fmax) + if (x < fmax) { assert(static_cast(x) > i); + } } template @@ -30,8 +34,9 @@ void TestUpperBoundExhaustive() { template constexpr T FillLsb(int n) { - if (n <= 0) + if (n <= 0) { return 0; + } T x{T{1} << (n - 1)}; return (x - 1) ^ x; } From 3fa04cc4fdd33a1c702ce9d1862b28d953289490 Mon Sep 17 00:00:00 2001 From: Matt Stephanson Date: Fri, 21 Aug 2020 18:37:16 -0700 Subject: [PATCH 11/13] suggestions from code review --- stl/inc/random | 14 ++-- .../test.cpp | 78 +++++++++++-------- 2 files changed, 52 insertions(+), 40 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index a2ad738580..39db17f122 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2034,7 +2034,8 @@ basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, template _NODISCARD _Flt _Float_upper_bound(_Ty _Val) { - static_assert(is_unsigned_v<_Ty> && is_floating_point_v<_Flt>, "invalid template argument for _Float_upper_bound"); + static_assert(is_unsigned_v<_Ty> && is_integral_v<_Ty> && is_floating_point_v<_Flt>, + "invalid template argument for _Float_upper_bound"); constexpr auto _Ty_digits = numeric_limits<_Ty>::digits; constexpr auto _Flt_digits = numeric_limits<_Flt>::digits; using _Ty_32or64 = conditional_t<_Ty_digits <= 32, uint32_t, uint64_t>; @@ -2043,12 +2044,11 @@ _NODISCARD _Flt _Float_upper_bound(_Ty _Val) { return static_cast<_Flt>(_Val) + _Flt{1}; } else { #pragma warning(push) -#pragma warning(disable : 4146) // unary minus of unsigned - constexpr auto _Mask_shift = (_Ty_digits > _Flt_digits) ? _Ty_digits - _Flt_digits : 0; - constexpr auto _Mask = _Ty(-1) << _Mask_shift; - const auto _Log_plus1 = _Bit_scan_reverse(static_cast<_Ty_32or64>(_Val | _Ty{1})); - const auto _Shifted_mask = _Mask >> (_Ty_digits - _Log_plus1); - const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; +#pragma warning(disable : 4146 4293) // unary minus of unsigned, negative shift + constexpr auto _Mask = _Ty(-1) << (_Ty_digits - _Flt_digits); + const auto _Log_plus1 = _Bit_scan_reverse(static_cast<_Ty_32or64>(_Val | _Ty{1})); + const auto _Shifted_mask = _Mask >> (_Ty_digits - _Log_plus1); + const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; _Val &= _Shifted_mask; if (_Val == _Mask) { // integer add would overflow diff --git a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp index d58b36b214..1ae2a9468e 100644 --- a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp +++ b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp @@ -7,29 +7,34 @@ #include #include +#pragma warning(disable : 4984) // if constexpr is a C++17 language extension +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wc++17-extensions" +#endif // __clang__ + template using lim = std::numeric_limits; -template -void CheckUpperBound(T i, float fmax) { - const float x{std::_Float_upper_bound(i)}; - const float y{std::nextafter(x, 0.0f)}; // lower bound, <= i +template +void CheckUpperBound(IntType i, FltType fmax) { + const auto x{std::_Float_upper_bound(i)}; + const auto y{std::nextafter(x, FltType{0})}; // lower bound, <= i assert(y < fmax); - assert(static_cast(y) <= i); + assert(static_cast(y) <= i); assert(x <= fmax); if (x < fmax) { - assert(static_cast(x) > i); + assert(static_cast(x) > i); } } -template +template void TestUpperBoundExhaustive() { - const float fmax{exp2(static_cast(lim::digits))}; - T i{0}; + const auto fmax{exp2(static_cast(lim::digits))}; + IntType i{0}; do { CheckUpperBound(i, fmax); - } while (++i != T{0}); + } while (++i != IntType{0}); } template @@ -41,34 +46,41 @@ constexpr T FillLsb(int n) { return (x - 1) ^ x; } -template +template void TestUpperBoundSelective() { - const float fmax{exp2(static_cast(lim::digits))}; - CheckUpperBound(T{0}, fmax); - CheckUpperBound(T{1}, fmax); - CheckUpperBound(lim::max(), fmax); + const auto fmax{exp2(static_cast(lim::digits))}; + CheckUpperBound(IntType{0}, fmax); + CheckUpperBound(IntType{1}, fmax); + CheckUpperBound(lim::max(), fmax); - // crossover from ulp < 1 to ulp = 1 - constexpr T a{FillLsb(lim::digits - 1)}; - CheckUpperBound(a - 1, fmax); - CheckUpperBound(a, fmax); + constexpr int diff{lim::digits - lim::digits}; + if constexpr (diff > 0) { + // crossover from ulp < 1 to ulp = 1 + constexpr auto a{FillLsb(lim::digits - 1)}; + CheckUpperBound(a - 1, fmax); + CheckUpperBound(a, fmax); - // crossover from ulp = 1 to ulp > 1 - constexpr T b{FillLsb(lim::digits)}; - CheckUpperBound(b, fmax); - CheckUpperBound(b + 1, fmax); - CheckUpperBound(b + 2, fmax); + // crossover from ulp = 1 to ulp > 1 + constexpr auto b{FillLsb(lim::digits)}; + CheckUpperBound(b, fmax); + CheckUpperBound(b + 1, fmax); + CheckUpperBound(b + 2, fmax); - // saturation at the largest representable T - constexpr int diff{lim::digits - lim::digits}; - constexpr T c{FillLsb(lim::digits) << diff}; - CheckUpperBound(c - 1, fmax); - CheckUpperBound(c, fmax); - CheckUpperBound(c + 1, fmax); + // saturation at the largest representable IntType + constexpr auto c{FillLsb(lim::digits) << diff}; + CheckUpperBound(c - 1, fmax); + CheckUpperBound(c, fmax); + CheckUpperBound(c + 1, fmax); + } } int main() { - TestUpperBoundExhaustive(); - TestUpperBoundExhaustive(); - TestUpperBoundSelective(); + TestUpperBoundExhaustive(); + TestUpperBoundExhaustive(); + TestUpperBoundSelective(); + + TestUpperBoundExhaustive(); + TestUpperBoundSelective(); + TestUpperBoundSelective(); + TestUpperBoundSelective(); } From 13a25279d9645bd49d1e7d8abcdab4c2d223dad8 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 2 Oct 2020 02:35:15 -0700 Subject: [PATCH 12/13] Apply suggestions from code review --- stl/inc/random | 6 +++--- tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index 39db17f122..0346b6221f 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2045,7 +2045,7 @@ _NODISCARD _Flt _Float_upper_bound(_Ty _Val) { } else { #pragma warning(push) #pragma warning(disable : 4146 4293) // unary minus of unsigned, negative shift - constexpr auto _Mask = _Ty(-1) << (_Ty_digits - _Flt_digits); + constexpr auto _Mask = static_cast<_Ty>(-1) << (_Ty_digits - _Flt_digits); const auto _Log_plus1 = _Bit_scan_reverse(static_cast<_Ty_32or64>(_Val | _Ty{1})); const auto _Shifted_mask = _Mask >> (_Ty_digits - _Log_plus1); const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; @@ -2333,7 +2333,7 @@ private: for (;;) { // generate and reject using _Uty = make_unsigned_t<_Ty>; constexpr auto _Ty_max{(numeric_limits<_Ty>::max)()}; - const auto _Ty1_max{_Float_upper_bound<_Ty1, _Uty>(static_cast<_Uty>(_Ty_max))}; + const auto _Ty1_max{_Float_upper_bound<_Ty1>(static_cast<_Uty>(_Ty_max))}; _Ty _Res; _Ty1 _Yx; @@ -2519,7 +2519,7 @@ private: _Res = _Par0._Small(_Eng); } else { // no shortcuts using _Uty = make_unsigned_t<_Ty>; - const auto _Ty1_Tx{_Float_upper_bound<_Ty1, _Uty>(static_cast<_Uty>(_Par0._Tx))}; + const auto _Ty1_Tx{_Float_upper_bound<_Ty1>(static_cast<_Uty>(_Par0._Tx))}; for (;;) { // generate and reject _Ty1 _Yx; diff --git a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp index 1ae2a9468e..b2a9cbb6e2 100644 --- a/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp +++ b/tests/std/tests/GH_001123_random_cast_out_of_range/test.cpp @@ -79,8 +79,8 @@ int main() { TestUpperBoundExhaustive(); TestUpperBoundSelective(); - TestUpperBoundExhaustive(); + TestUpperBoundExhaustive(); TestUpperBoundSelective(); - TestUpperBoundSelective(); - TestUpperBoundSelective(); + TestUpperBoundSelective(); + TestUpperBoundSelective(); } From 4afbecc1bff6c4b5fbc0b3f61d623866789c3ae0 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 2 Oct 2020 17:17:16 -0700 Subject: [PATCH 13/13] Fix /clr:pure compiler error. Most intrinsics, including _BitScanReverse, are unavailable in /clr:pure mode. The most targeted way to fix this is to call _Countl_zero_fallback which is available from . I've manually tested that these codepaths behave identically. --- stl/inc/random | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index 0346b6221f..e8bffaed38 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2045,8 +2045,13 @@ _NODISCARD _Flt _Float_upper_bound(_Ty _Val) { } else { #pragma warning(push) #pragma warning(disable : 4146 4293) // unary minus of unsigned, negative shift - constexpr auto _Mask = static_cast<_Ty>(-1) << (_Ty_digits - _Flt_digits); - const auto _Log_plus1 = _Bit_scan_reverse(static_cast<_Ty_32or64>(_Val | _Ty{1})); + constexpr auto _Mask = static_cast<_Ty>(-1) << (_Ty_digits - _Flt_digits); +#ifdef _M_CEE_PURE + constexpr auto _Ty_32or64_digits = numeric_limits<_Ty_32or64>::digits; + const auto _Log_plus1 = _Ty_32or64_digits - _Countl_zero_fallback(static_cast<_Ty_32or64>(_Val | _Ty{1})); +#else // _M_CEE_PURE + const auto _Log_plus1 = _Bit_scan_reverse(static_cast<_Ty_32or64>(_Val | _Ty{1})); +#endif // _M_CEE_PURE const auto _Shifted_mask = _Mask >> (_Ty_digits - _Log_plus1); const auto _Ceil_ulp = _Shifted_mask & -_Shifted_mask; _Val &= _Shifted_mask;