diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-28 16:15:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-02-28 16:15:46 +0000 |
commit | 3ae57096ae33eeed5b4e658ebdf3563a6dd86474 (patch) | |
tree | 075a7bd4d85eeda4e500e0f346f64390aa1f9a4d | |
parent | 9fadf818e9de0813e8904acb994560d5a18a18ec (diff) |
use memset instead of loop
Change-Id: I572f52658914a0814bc3d3990830e247275e110b
-rw-r--r-- | filter/source/graphicfilter/itiff/ccidecom.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/filter/source/graphicfilter/itiff/ccidecom.cxx b/filter/source/graphicfilter/itiff/ccidecom.cxx index 1cb7d7d53448..125d9c85d5e4 100644 --- a/filter/source/graphicfilter/itiff/ccidecom.cxx +++ b/filter/source/graphicfilter/itiff/ccidecom.cxx @@ -995,10 +995,14 @@ void CCIDecompressor::Read1DScanlineData(sal_uInt8 * pTarget, sal_uInt16 nTarget nDataBits = nDataBits - nTgtFreeByteBits; pTarget++; nTgtFreeByteBits=8; - while (nDataBits>=8) { - *(pTarget++)=nBlackOrWhite; - nDataBits-=8; + if (nDataBits >= 8) + { + const sal_uInt16 nDataBytes = nDataBits / 8; + memset(pTarget, nBlackOrWhite, nDataBytes); + pTarget += nDataBytes; + nDataBits -= nDataBytes * 8; } + if (nDataBits>0) { *pTarget=nBlackOrWhite; nTgtFreeByteBits = nTgtFreeByteBits - nDataBits; |