Skip to content

Commit

Permalink
Add missing inline attributes to avoid linker issues.
Browse files Browse the repository at this point in the history
The `xoshiro<2>::do_jump` specializations need some `inline` attribute,
otherwise including dqrng from multiple compilation units causes linker
errors due to symbols being defined multiple times.
  • Loading branch information
plietar committed Jan 19, 2024
1 parent 7853a3e commit 26c397a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inst/include/xoshiro.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class xoshiro {
};

template<>
void xoshiro<2>::do_jump(std::array<result_type, 2> JUMP) {
inline void xoshiro<2>::do_jump(std::array<result_type, 2> JUMP) {
uint64_t s0 = 0;
uint64_t s1 = 0;
for(unsigned int i = 0; i < sizeof JUMP / sizeof JUMP.begin(); i++)
Expand All @@ -121,7 +121,7 @@ void xoshiro<2>::do_jump(std::array<result_type, 2> JUMP) {
}

template<>
void xoshiro<4>::do_jump(std::array<result_type, 4> JUMP) {
inline void xoshiro<4>::do_jump(std::array<result_type, 4> JUMP) {
uint64_t s0 = 0;
uint64_t s1 = 0;
uint64_t s2 = 0;
Expand Down

0 comments on commit 26c397a

Please sign in to comment.