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

Method read

dlib/bit_stream/bit_stream_kernel_1.cpp:137–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135// ----------------------------------------------------------------------------------------
136
137 bool bit_stream_kernel_1::
138 read (
139 int& bit
140 )
141 {
142 // get new byte if necessary
143 if (buffer_size == 0)
144 {
145 if (isp->rdbuf()->sgetn(reinterpret_cast<char*>(&buffer), 1) == 0)
146 {
147 // if we didn't read anything then return false
148 return false;
149 }
150
151 buffer_size = 8;
152 }
153
154 // put the most significant bit from buffer into bit
155 bit = static_cast<int>(buffer >> 7);
156
157 // shift out the bit that was just read
158 buffer <<= 1;
159 --buffer_size;
160
161 return true;
162 }
163
164// ----------------------------------------------------------------------------------------
165

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected