MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / getValueRequiredBits

Function getValueRequiredBits

src/lodepng.cpp:3543–3549  ·  view source on GitHub ↗

Returns how many bits needed to represent given value (max 8 bit)*/

Source from the content-addressed store, hash-verified

3541
3542/*Returns how many bits needed to represent given value (max 8 bit)*/
3543unsigned getValueRequiredBits(unsigned short value)
3544{
3545 if(value == 0 || value == 255) return 1;
3546 /*The scaling of 2-bit and 4-bit values uses multiples of 85 and 17*/
3547 if(value % 17 == 0) return value % 85 == 0 ? 2 : 4;
3548 return 8;
3549}
3550
3551/*profile must already have been inited with mode.
3552It's ok to set some parameters of profile to done already.*/

Callers 1

get_color_profileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected