Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/catch2/internal/catch_random_number_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
// SPDX-License-Identifier: BSL-1.0
#include <catch2/internal/catch_random_number_generator.hpp>

#if defined( __clang__ )
# define CATCH2_CLANG_NO_SANITIZE_INTEGER \
__attribute__( ( no_sanitize( "undefined", "integer" ) ) )
#else
# define CATCH2_CLANG_NO_SANITIZE_INTEGER
#endif
namespace Catch {

namespace {
Expand All @@ -16,6 +22,7 @@ namespace {
#pragma warning(disable:4146) // we negate uint32 during the rotate
#endif
// Safe rotr implementation thanks to John Regehr
CATCH2_CLANG_NO_SANITIZE_INTEGER
uint32_t rotate_right(uint32_t val, uint32_t count) {
const uint32_t mask = 31;
count &= mask;
Expand Down Expand Up @@ -49,6 +56,7 @@ namespace {
}
}

CATCH2_CLANG_NO_SANITIZE_INTEGER
SimplePcg32::result_type SimplePcg32::operator()() {
// prepare the output value
const uint32_t xorshifted = static_cast<uint32_t>(((m_state >> 18u) ^ m_state) >> 27u);
Expand Down