diff --git a/src/compat/assumptions.h b/src/compat/assumptions.h --- a/src/compat/assumptions.h +++ b/src/compat/assumptions.h @@ -64,4 +64,17 @@ // * We are NOT assuming a specific value for // std::numeric_limits::is_signed. +/** + * /!\ C++ right shift signedness handling is implementation defined. It is + * defined as an arithmetic on all the platform we support, but this + * may not be the case on other platforms. + * + * NB: C++20 defines signed right shift as being arithmetic shifts, so in + * practice, we should see all platforms converge toward that behavior if + * they haven't already. + */ +static_assert( + (int64_t(-1) >> 1) == int64_t(-1), + "deterministicExp2 require a compiler using arithmetic right shift."); + #endif // BITCOIN_COMPAT_ASSUMPTIONS_H