cppcheck: Clean up signed 32 bit shift by 31
cppcheck moans about 1<<n where n can be 31; ubsan also complains; they're probably right even if it's unlikely to ever be a problem. Use 1U << 31 Change-Id: Ic83d7d240db4595c2562c1f91116491044d70bab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110173 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
This commit is contained in:
committed by
Michael Stahl
parent
e267fe1a3d
commit
c3a8fe7b40
@@ -197,7 +197,7 @@ sal_uInt32 Decompression::ReadBits(sal_uInt16 iCount, sal_uInt32 & nBits)
|
|||||||
m_nBitsLeft -= iCount;
|
m_nBitsLeft -= iCount;
|
||||||
|
|
||||||
/* return need bits, zeroing the bits above that */
|
/* return need bits, zeroing the bits above that */
|
||||||
nBits = val & ((1 << iCount) - 1);
|
nBits = val & ((1U << iCount) - 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -252,7 +252,7 @@ static sal_uInt32 lcl_ConvertStatusBarFuncSetToSingle( sal_uInt32 nFuncSet )
|
|||||||
if ( !nFuncSet )
|
if ( !nFuncSet )
|
||||||
return 0;
|
return 0;
|
||||||
for ( sal_uInt32 nFunc = 1; nFunc < 32; ++nFunc )
|
for ( sal_uInt32 nFunc = 1; nFunc < 32; ++nFunc )
|
||||||
if ( nFuncSet & ( 1 << nFunc ) )
|
if ( nFuncSet & ( 1U << nFunc ) )
|
||||||
return nFunc;
|
return nFunc;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -73,7 +73,7 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode )
|
|||||||
bool bFirst = true;
|
bool bFirst = true;
|
||||||
for ( sal_uInt16 nFunc = 0; nFunc < 32; nFunc++ )
|
for ( sal_uInt16 nFunc = 0; nFunc < 32; nFunc++ )
|
||||||
{
|
{
|
||||||
if ( !(nFuncs & (1 << nFunc)) )
|
if ( !(nFuncs & (1U << nFunc)) )
|
||||||
continue;
|
continue;
|
||||||
ScSubTotalFunc eFunc = static_cast<ScSubTotalFunc>(nFunc);
|
ScSubTotalFunc eFunc = static_cast<ScSubTotalFunc>(nFunc);
|
||||||
|
|
||||||
|
@@ -2234,7 +2234,7 @@ append(std::bitset<N> & rSet, size_t const nOffset, sal_uInt32 const nValue)
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < 32; ++i)
|
for (size_t i = 0; i < 32; ++i)
|
||||||
{
|
{
|
||||||
rSet.set(nOffset + i, (nValue & (1 << i)) != 0);
|
rSet.set(nOffset + i, (nValue & (1U << i)) != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user