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
@@ -335,12 +335,9 @@ EIGEN_DEVICE_FUNC inline Packet psub(const Packet& a, const Packet& b) {
|
||||
/** \internal \returns -a (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DEVICE_FUNC inline Packet pnegate(const Packet& a) {
|
||||
return -a;
|
||||
}
|
||||
|
||||
template <>
|
||||
EIGEN_DEVICE_FUNC inline bool pnegate(const bool& a) {
|
||||
return !a;
|
||||
EIGEN_STATIC_ASSERT((!is_same<typename unpacket_traits<Packet>::type, bool>::value),
|
||||
NEGATE IS NOT DEFINED FOR BOOLEAN TYPES)
|
||||
return numext::negate(a);
|
||||
}
|
||||
|
||||
/** \internal \returns conj(a) (coeff-wise) */
|
||||
@@ -1117,8 +1114,9 @@ EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog10(const Packet&
|
||||
/** \internal \returns the log10 of \a a (coeff-wise) */
|
||||
template <typename Packet>
|
||||
EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog2(const Packet& a) {
|
||||
typedef typename internal::unpacket_traits<Packet>::type Scalar;
|
||||
return pmul(pset1<Packet>(Scalar(EIGEN_LOG2E)), plog(a));
|
||||
using Scalar = typename internal::unpacket_traits<Packet>::type;
|
||||
using RealScalar = typename NumTraits<Scalar>::Real;
|
||||
return pmul(pset1<Packet>(Scalar(RealScalar(EIGEN_LOG2E))), plog(a));
|
||||
}
|
||||
|
||||
/** \internal \returns the square-root of \a a (coeff-wise) */
|
||||
@@ -1403,6 +1401,12 @@ EIGEN_DEVICE_FUNC inline void ptranspose(PacketBlock<Packet, 1>& /*kernel*/) {
|
||||
template <size_t N>
|
||||
struct Selector {
|
||||
bool select[N];
|
||||
template <typename MaskType = int>
|
||||
EIGEN_DEVICE_FUNC inline MaskType mask(size_t begin = 0, size_t end = N) const {
|
||||
MaskType res = 0;
|
||||
for (size_t i = begin; i < end; i++) res |= (static_cast<MaskType>(select[i]) << i);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Packet>
|
||||
|
||||
Reference in New Issue
Block a user