[Libreoffice-commits] core.git: basebmp/inc
Stephan Bergmann
sbergman at redhat.com
Thu Oct 22 00:42:27 PDT 2015
basebmp/inc/metafunctions.hxx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit 8bde421ccec9c10fe1382ad68485852889dd4c74
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 22 09:40:08 2015 +0200
Work around cid#1328486
...claiming that "right shifting v by more than 15 bits always yields zero,"
apparently diagnosing an instanatiation of the template for T = unsigned short.
Change-Id: I7c210ff17e4aef8f0e703cc30518f3420e67e7c1
diff --git a/basebmp/inc/metafunctions.hxx b/basebmp/inc/metafunctions.hxx
index 4e6efb4..4c35f3b 100644
--- a/basebmp/inc/metafunctions.hxx
+++ b/basebmp/inc/metafunctions.hxx
@@ -214,10 +214,11 @@ template< typename T > inline T shiftRight( T v, int shift )
static_assert(
std::is_unsigned<T>::value,
"must be unsigned for promotedBits and the below ': 0' to be correct");
- auto const promotedBits = std::numeric_limits<decltype(+T())>::digits;
+ using Promoted = decltype(+T());
+ auto const promotedBits = std::numeric_limits<Promoted>::digits;
return shift >= 0
- ? shift < promotedBits ? v >> shift : 0
- : -shift < promotedBits ? v << (-shift) : 0;
+ ? shift < promotedBits ? Promoted(v) >> shift : 0
+ : -shift < promotedBits ? Promoted(v) << (-shift) : 0;
}
} // namespace basebmp
More information about the Libreoffice-commits
mailing list