MCPcopy Create free account
hub / github.com/davisking/dlib / write

Method write

dlib/bit_stream/bit_stream_kernel_1.cpp:113–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111// ----------------------------------------------------------------------------------------
112
113 void bit_stream_kernel_1::
114 write (
115 int bit
116 )
117 {
118 // flush buffer if necessary
119 if (buffer_size == 8)
120 {
121 buffer <<= 8 - buffer_size;
122 if (osp->rdbuf()->sputn(reinterpret_cast<char*>(&buffer),1) == 0)
123 {
124 throw std::ios_base::failure("error occurred in the bit_stream object");
125 }
126
127 buffer_size = 0;
128 }
129
130 ++buffer_size;
131 buffer <<= 1;
132 buffer += static_cast<unsigned char>(bit);
133 }
134
135// ----------------------------------------------------------------------------------------
136

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected