MCPcopy Create free account
hub / github.com/c3d/tao3D / Put2

Method Put2

libcryptopp/cryptopp/basecode.cpp:39–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39size_t BaseN_Encoder::Put2(const byte *begin, size_t length, int messageEnd, bool blocking)
40{
41 FILTER_BEGIN;
42 while (m_inputPosition < length)
43 {
44 if (m_bytePos == 0)
45 memset(m_outBuf, 0, m_outputBlockSize);
46
47 {
48 unsigned int b = begin[m_inputPosition++], bitsLeftInSource = 8;
49 while (true)
50 {
51 assert(m_bitPos < m_bitsPerChar);
52 unsigned int bitsLeftInTarget = m_bitsPerChar-m_bitPos;
53 m_outBuf[m_bytePos] |= b >> (8-bitsLeftInTarget);
54 if (bitsLeftInSource >= bitsLeftInTarget)
55 {
56 m_bitPos = 0;
57 ++m_bytePos;
58 bitsLeftInSource -= bitsLeftInTarget;
59 if (bitsLeftInSource == 0)
60 break;
61 b <<= bitsLeftInTarget;
62 b &= 0xff;
63 }
64 else
65 {
66 m_bitPos += bitsLeftInSource;
67 break;
68 }
69 }
70 }
71
72 assert(m_bytePos <= m_outputBlockSize);
73 if (m_bytePos == m_outputBlockSize)
74 {
75 int i;
76 for (i=0; i<m_bytePos; i++)
77 {
78 assert(m_outBuf[i] < (1 << m_bitsPerChar));
79 m_outBuf[i] = m_alphabet[m_outBuf[i]];
80 }
81 FILTER_OUTPUT(1, m_outBuf, m_outputBlockSize, 0);
82
83 m_bytePos = m_bitPos = 0;
84 }
85 }
86 if (messageEnd)
87 {
88 if (m_bitPos > 0)
89 ++m_bytePos;
90
91 int i;
92 for (i=0; i<m_bytePos; i++)
93 m_outBuf[i] = m_alphabet[m_outBuf[i]];
94
95 if (m_padding != -1 && m_bytePos > 0)
96 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected