Skip to content

Commit

Permalink
Remove unnecessary cast
Browse files Browse the repository at this point in the history
  • Loading branch information
rstub committed Apr 29, 2024
1 parent f2bf55d commit 44e01d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inst/include/dqrng_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ inline void random_64bit_wrapper<pcg64>::set_stream(result_type stream) {
state.push_back(number);
// state[1] is the current stream
// PCG will do 2*stream + 1 to make sure stream is odd; need to revert that here
gen.set_stream(pcg_extras::pcg128_t(state[1]/2) + stream);
gen.set_stream(state[1]/2 + stream);
}

inline uint64_t get_seed_from_r() {
Expand Down

2 comments on commit 44e01d9

@barracuda156
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rstub I guess, this has broken it? :)
#88

@barracuda156
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPD. No, something else, sorry. Reverting this change does not help, build still fails:

In file included from dqrng.cpp:21:
../inst/include/dqrng_generator.h: In member function 'void dqrng::random_64bit_wrapper<RNG>::set_stream(dqrng::random_64bit_generator::result_type) [with RNG = pcg_detail::engine<long long unsigned int, pcg_extras::uint_x4<unsigned int, long long unsigned int>, pcg_detail::xsl_rr_mixin<long long unsigned int, pcg_extras::uint_x4<unsigned int, long long unsigned int> >, false, pcg_detail::specific_stream<pcg_extras::uint_x4<unsigned int, long long unsigned int> >, pcg_detail::default_multiplier<pcg_extras::uint_x4<unsigned int, long long unsigned int> > >; dqrng::random_64bit_generator::result_type = long long unsigned int]':
../inst/include/dqrng_generator.h:115:47: error: no match for 'operator/' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<pcg_extras::uint_x4<unsigned int, long long unsigned int> >, pcg_extras::uint_x4<unsigned int, long long unsigned int> >::value_type' {aka 'pcg_extras::uint_x4<unsigned int, long long unsigned int>'} and 'int')
  115 |   gen.set_stream(pcg_extras::pcg128_t(state[1]/2) + stream);
../inst/include/dqrng_generator.h:115:47: note: candidate: 'operator/(int, int)' (built-in)
../inst/include/dqrng_generator.h:115:47: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<pcg_extras::uint_x4<unsigned int, long long unsigned int> >, pcg_extras::uint_x4<unsigned int, long long unsigned int> >::value_type' {aka 'pcg_extras::uint_x4<unsigned int, long long unsigned int>'} to 'int'
../inst/include/dqrng_generator.h:115:47: note: candidate: 'operator/(long unsigned int, int)' (built-in)
../inst/include/dqrng_generator.h:115:47: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<pcg_extras::uint_x4<unsigned int, long long unsigned int> >, pcg_extras::uint_x4<unsigned int, long long unsigned int> >::value_type' {aka 'pcg_extras::uint_x4<unsigned int, long long unsigned int>'} to 'long unsigned int'
../inst/include/dqrng_generator.h:115:47: note: candidate: 'operator/(unsigned int, int)' (built-in)
../inst/include/dqrng_generator.h:115:47: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<pcg_extras::uint_x4<unsigned int, long long unsigned int> >, pcg_extras::uint_x4<unsigned int, long long unsigned int> >::value_type' {aka 'pcg_extras::uint_x4<unsigned int, long long unsigned int>'} to 'unsigned int'
../inst/include/dqrng_generator.h:115:47: note: candidate: 'operator/(long long unsigned int, int)' (built-in)
../inst/include/dqrng_generator.h:115:47: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<pcg_extras::uint_x4<unsigned int, long long unsigned int> >, pcg_extras::uint_x4<unsigned int, long long unsigned int> >::value_type' {aka 'pcg_extras::uint_x4<unsigned int, long long unsigned int>'} to 'long long unsigned int'
In file included from ../inst/include/pcg_extras.hpp:84,
                 from ../inst/include/dqrng_types.h:27,
                 from ../inst/include/dqrng_generator.h:24:
../inst/include/pcg_uint128.hpp:559:22: note: candidate: 'template<class UInt, class UIntX2> pcg_extras::uint_x4<U, V> pcg_extras::operator/(const uint_x4<U, V>&, const uint_x4<U, V>&)'
  559 | uint_x4<UInt,UIntX2> operator/(const uint_x4<UInt,UIntX2>& dividend,
      |                      ^~~~~~~~
../inst/include/pcg_uint128.hpp:559:22: note:   template argument deduction/substitution failed:
../inst/include/dqrng_generator.h:115:48: note:   mismatched types 'const pcg_extras::uint_x4<U, V>' and 'int'
  115 |   gen.set_stream(pcg_extras::pcg128_t(state[1]/2) + stream);
      |                                                ^
In file included from /opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/RcppCommon.h:137,
                 from /opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/Rcpp.h:27,
                 from dqrng.cpp:20:
/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/Rcpp/complex.h:46:17: note: candidate: 'Rcomplex operator/(const Rcomplex&, const Rcomplex&)'
   46 | inline Rcomplex operator/( const Rcomplex& a, const Rcomplex& b) {
      |                 ^~~~~~~~
/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/Rcpp/complex.h:46:44: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<pcg_extras::uint_x4<unsigned int, long long unsigned int> >, pcg_extras::uint_x4<unsigned int, long long unsigned int> >::value_type' {aka 'pcg_extras::uint_x4<unsigned int, long long unsigned int>'} to 'const Rcomplex&'
   46 | inline Rcomplex operator/( const Rcomplex& a, const Rcomplex& b) {
      |                            ~~~~~~~~~~~~~~~~^
In file included from ../inst/include/dqrng_generator.h:26:
../inst/include/pcg_random.hpp: In instantiation of 'void pcg_detail::specific_stream<itype>::set_stream(itype) [with itype = pcg_extras::uint_x4<unsigned int, long long unsigned int>]':
../inst/include/pcg_random.hpp:610:26:   required from 'std::basic_istream<_CharT, _Traits>& pcg_detail::operator>>(std::basic_istream<_CharT, _Traits>&, engine<xtype, itype, output_mixin, output_previous, stream_mixin, multiplier_mixin>&) [with CharT = char; Traits = std::char_traits<char>; xtype = long long unsigned int; itype = pcg_extras::uint_x4<unsigned int, long long unsigned int>; output_mixin = xsl_rr_mixin<long long unsigned int, pcg_extras::uint_x4<unsigned int, long long unsigned int> >; bool output_previous = false; stream_mixin = specific_stream<pcg_extras::uint_x4<unsigned int, long long unsigned int> >; multiplier_mixin = default_multiplier<pcg_extras::uint_x4<unsigned int, long long unsigned int> >]'
../inst/include/dqrng_generator.h:55:55:   required from 'void dqrng::random_64bit_wrapper<RNG>::input(std::istream&) [with RNG = pcg_detail::engine<long long unsigned int, pcg_extras::uint_x4<unsigned int, long long unsigned int>, pcg_detail::xsl_rr_mixin<long long unsigned int, pcg_extras::uint_x4<unsigned int, long long unsigned int> >, false, pcg_detail::specific_stream<pcg_extras::uint_x4<unsigned int, long long unsigned int> >, pcg_detail::default_multiplier<pcg_extras::uint_x4<unsigned int, long long unsigned int> > >; std::istream = std::basic_istream<char>]'
../inst/include/dqrng_generator.h:55:16:   required from here
../inst/include/pcg_random.hpp:322:37: error: no match for 'operator|' (operand types are 'pcg_extras::uint_x4<unsigned int, long long unsigned int>' and 'int')
  322 |          inc_ = (specific_seq << 1) | 1;
      |                 ~~~~~~~~~~~~~~~~~~~~^~~
../inst/include/pcg_random.hpp:322:37: note: candidate: 'operator|(int, int)' (built-in)
../inst/include/pcg_random.hpp:322:37: note:   no known conversion for argument 1 from 'pcg_extras::uint_x4<unsigned int, long long unsigned int>' to 'int'
../inst/include/pcg_random.hpp:322:37: note: candidate: 'operator|(long unsigned int, int)' (built-in)
../inst/include/pcg_random.hpp:322:37: note:   no known conversion for argument 1 from 'pcg_extras::uint_x4<unsigned int, long long unsigned int>' to 'long unsigned int'
../inst/include/pcg_random.hpp:322:37: note: candidate: 'operator|(unsigned int, int)' (built-in)
../inst/include/pcg_random.hpp:322:37: note:   no known conversion for argument 1 from 'pcg_extras::uint_x4<unsigned int, long long unsigned int>' to 'unsigned int'
../inst/include/pcg_random.hpp:322:37: note: candidate: 'operator|(long long unsigned int, int)' (built-in)
../inst/include/pcg_random.hpp:322:37: note:   no known conversion for argument 1 from 'pcg_extras::uint_x4<unsigned int, long long unsigned int>' to 'long long unsigned int'
../inst/include/pcg_uint128.hpp:664:22: note: candidate: 'template<class UInt, class UIntX2> pcg_extras::uint_x4<U, V> pcg_extras::operator|(const uint_x4<U, V>&, const uint_x4<U, V>&)'
  664 | uint_x4<UInt,UIntX2> operator|(const uint_x4<UInt,UIntX2>& a,
      |                      ^~~~~~~~
../inst/include/pcg_uint128.hpp:664:22: note:   template argument deduction/substitution failed:
../inst/include/pcg_random.hpp:322:37: note:   mismatched types 'const pcg_extras::uint_x4<U, V>' and 'int'
  322 |          inc_ = (specific_seq << 1) | 1;
      |                 ~~~~~~~~~~~~~~~~~~~~^~~
In file included from /opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/Rcpp/sugar/logical/logical.h:30,
                 from /opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/Rcpp/sugar/sugar_forward.h:29,
                 from /opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/RcppCommon.h:184:
/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/Rcpp/sugar/logical/or.h:315:1: note: candidate: 'template<bool LHS_NA, class LHS_T, bool RHS_NA, class RHS_T> Rcpp::sugar::Or_LogicalExpression_LogicalExpression<LHS_NA, LHS_T, RHS_NA, RHS_T> operator|(const Rcpp::VectorBase<10, LHS_NA, LHS_T>&, const Rcpp::VectorBase<10, RHS_NA, RHS_T>&)'
  315 | operator|(
      | ^~~~~~~~
/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include/Rcpp/sugar/logical/or.h:315:1: note:   template argument deduction/substitution failed:
../inst/include/pcg_random.hpp:322:37: note:   'pcg_extras::uint_x4<unsigned int, long long unsigned int>' is not derived from 'const Rcpp::VectorBase<10, LHS_NA, LHS_T>'
  322 |          inc_ = (specific_seq << 1) | 1;
      |                 ~~~~~~~~~~~~~~~~~~~~^~~
make: *** [dqrng.o] Error 1
ERROR: compilation failed for package ‘dqrng’

Please sign in to comment.