fix UB in random implementation and tests

libeigen/eigen!2102
This commit is contained in:
Charles Schlosser
2025-12-31 03:57:04 +00:00
committed by Antonio Sánchez
parent c5aa40675a
commit c30af8f3db
3 changed files with 15 additions and 10 deletions

View File

@@ -83,7 +83,9 @@ class HistogramHelper {
// helper class to avoid extending std:: namespace
template <typename T>
struct get_range_type : internal::make_unsigned<T> {};
struct get_range_type {
using type = std::conditional_t<(sizeof(T) < sizeof(int)), unsigned int, std::make_unsigned_t<T>>;
};
template <typename T>
struct get_range_type<SafeScalar<T>> : internal::make_unsigned<T> {};