MCPcopy Create free account
hub / github.com/ImpulseAdventure/JPEGsnoop / ScanBuffAdd

Method ScanBuffAdd

ImgDecode.cpp:974–988  ·  view source on GitHub ↗

Augment the current scan buffer with another byte - Extra bits are added to right side of existing bitstring INPUT: - nNewByte = 8-bit byte to add to buffer - nPtr = UNUSED PRE: - m_nScanBuff - m_nScanBuff_vacant - m_nScanBuffPtr_num POST: - m_nScanBuff - m_nScanBuff_vacant - m_anScanBuffPtr_err[] - m_anScanBuffPtr_pos[]

Source from the content-addressed store, hash-verified

972// - m_anScanBuffPtr_pos[]
973//
974inline void CimgDecode::ScanBuffAdd(unsigned nNewByte,unsigned nPtr)
975{
976 // Add the new byte to the buffer
977 // Assume that m_nScanBuff has already been shifted to be
978 // aligned to bit 31 as first bit.
979 m_nScanBuff += (nNewByte << (m_nScanBuff_vacant-8));
980 m_nScanBuff_vacant -= 8;
981
982 ASSERT(m_nScanBuffPtr_num<4);
983 if (m_nScanBuffPtr_num>=4) { return; } // Unexpected by design
984 m_anScanBuffPtr_err[m_nScanBuffPtr_num] = SCANBUF_OK;
985 m_anScanBuffPtr_pos[m_nScanBuffPtr_num++] = nPtr;
986
987 // m_nScanBuffPtr_align stays the same as we add 8 bits
988}
989
990// Augment the current scan buffer with another byte (but mark as error)
991//

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected