mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix "unary minus operator applied to unsigned type, result still unsigned" on MSVC and other stupid warnings
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
dcdb0233c1
commit
122befe54c
@@ -22,11 +22,16 @@ namespace Eigen {
|
||||
|
||||
namespace test {
|
||||
|
||||
template <typename T>
|
||||
template <typename T, std::enable_if_t<NumTraits<T>::IsSigned, bool> = true>
|
||||
T negate(const T& x) {
|
||||
return -x;
|
||||
}
|
||||
|
||||
template <typename T, std::enable_if_t<!NumTraits<T>::IsSigned, bool> = true>
|
||||
T negate(const T& x) {
|
||||
return T(0) - x;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Map<const Array<unsigned char, sizeof(T), 1> > bits(const T& x) {
|
||||
return Map<const Array<unsigned char, sizeof(T), 1> >(reinterpret_cast<const unsigned char*>(&x));
|
||||
|
||||
Reference in New Issue
Block a user