From 1e2e858035fcd5768903408d44a7eb43cfb0d3b9 Mon Sep 17 00:00:00 2001 From: Bram de Greve Date: Sat, 25 Nov 2023 18:50:36 +0100 Subject: [PATCH] Fix MSVC errors in operator>> Using operator>> failed to compile with pcg_engines::cm_setseq_dxsm_128_64 with following errors (MSVC 2022 (17.7.3) with /std:c++20): include\pcg_random.hpp(621,13): error C2678: binary '!=': no operator found which takes a left-hand operand of type 'pcg_extras::pcg128_t' (or there is no acceptable conversion) include\pcg_random.hpp(336,34): error C2678: binary '|': no operator found which takes a left-hand operand of type 'pcg_extras::uint_x4' (or there is no acceptable conversion) --- include/pcg_random.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pcg_random.hpp b/include/pcg_random.hpp index d479a81..fd3183b 100644 --- a/include/pcg_random.hpp +++ b/include/pcg_random.hpp @@ -333,7 +333,7 @@ class specific_stream { void set_stream(itype specific_seq) { - inc_ = (specific_seq << 1) | 1; + inc_ = (specific_seq << 1) | itype(1U); } static constexpr bool can_specify_stream = true; @@ -618,7 +618,7 @@ operator>>(std::basic_istream& in, if (!in.fail()) { bool good = true; - if (multiplier != rng.multiplier()) { + if (multiplier != itype(rng.multiplier())) { good = false; } else if (rng.can_specify_stream) { rng.set_stream(increment >> 1);