[Libreoffice-commits] core.git: include/basebmp
Stephan Bergmann
sbergman at redhat.com
Thu Aug 29 04:31:59 PDT 2013
include/basebmp/packedpixeliterator.hxx | 2 +-
include/basebmp/polypolygonrenderer.hxx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 616197d8077fa3936b609a41557036184d45367d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Aug 29 13:30:44 2013 +0200
left shift of negative values (Clang -fsanitize=undefined)
Change-Id: I1747959bd51f066b017cbf5d161ebe37f3df02e6
diff --git a/include/basebmp/packedpixeliterator.hxx b/include/basebmp/packedpixeliterator.hxx
index 89a8850..55cc174 100644
--- a/include/basebmp/packedpixeliterator.hxx
+++ b/include/basebmp/packedpixeliterator.hxx
@@ -47,7 +47,7 @@ inline value_type get_mask( difference_type d )
const unsigned int nIntraWordPositions( sizeof(value_type)*8 / bits_per_pixel );
// create bits_per_pixel 1s shift to intra-word position
- return ((~(~0 << bits_per_pixel)) << bits_per_pixel*(MsbFirst ?
+ return ((~(~0U << bits_per_pixel)) << bits_per_pixel*(MsbFirst ?
(nIntraWordPositions-1 - (d % nIntraWordPositions)) :
(d % nIntraWordPositions)));
}
diff --git a/include/basebmp/polypolygonrenderer.hxx b/include/basebmp/polypolygonrenderer.hxx
index 80f73ac..09bd18a 100644
--- a/include/basebmp/polypolygonrenderer.hxx
+++ b/include/basebmp/polypolygonrenderer.hxx
@@ -39,7 +39,7 @@ namespace basebmp
namespace detail
{
/// convert int32 to 32:32 fixed point
- inline sal_Int64 toFractional( sal_Int32 v ) { return (sal_Int64)v << 32; }
+ inline sal_Int64 toFractional( sal_Int32 v ) { return sal_Int64(sal_uInt64(v) << 32); }
/// convert double to 32:32 fixed point
inline sal_Int64 toFractional( double v ) { return (sal_Int64)(v*SAL_MAX_UINT32 + (v < 0.0 ? -0.5 : 0.5 )); }
/// convert 32:32 fixed point to int32 (truncate)
More information about the Libreoffice-commits
mailing list