diff options
Diffstat (limited to 'include/tools')
-rw-r--r-- | include/tools/helpers.hxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/tools/helpers.hxx b/include/tools/helpers.hxx index 858ec4f7fc50..30064cf93fc6 100644 --- a/include/tools/helpers.hxx +++ b/include/tools/helpers.hxx @@ -10,6 +10,7 @@ #define INCLUDED_TOOLS_HELPERS_HXX #include <sal/config.h> +#include <sal/types.h> #include <cassert> #include <type_traits> @@ -40,9 +41,13 @@ MinMax(T nVal, long nMin, long nMax) : nMin); } -inline long AlignedWidth4Bytes( long nWidthBits ) +inline sal_uInt32 AlignedWidth4Bytes(sal_uInt32 nWidthBits) { - return ( ( nWidthBits + 31 ) >> 5 ) << 2; + if (nWidthBits > SAL_MAX_UINT32 - 31) + nWidthBits = SAL_MAX_UINT32; + else + nWidthBits += 31; + return (nWidthBits >> 5) << 2; } inline long FRound( double fVal ) |