summaryrefslogtreecommitdiff
path: root/basebmp
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-10-22 09:40:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-10-22 09:40:08 +0200
commit8bde421ccec9c10fe1382ad68485852889dd4c74 (patch)
tree4c3895cc5379d76bea59ba5992adce6218ae6d73 /basebmp
parent1b3f81bd584cfceb537f04f3a240bf505d19b7bf (diff)
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
Diffstat (limited to 'basebmp')
-rw-r--r--basebmp/inc/metafunctions.hxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/basebmp/inc/metafunctions.hxx b/basebmp/inc/metafunctions.hxx
index 4e6efb44413f..4c35f3b801d0 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