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

Method get_target

dlib/entropy_decoder/entropy_decoder_kernel_1.cpp:201–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199// ----------------------------------------------------------------------------------------
200
201 uint32 entropy_decoder_kernel_1::
202 get_target (
203 uint32 total
204 )
205 {
206 // note that we must add one because of the convention that
207 // high == the real upper range minus 1
208 r = (high-low+1)/total;
209 uint32 temp = (target-low)/r;
210 if (temp < total)
211 return temp;
212 else
213 return total-1;
214 }
215
216// ----------------------------------------------------------------------------------------
217

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected