MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__clamp

Function stbi__clamp

include/stb/stb_image.h:2416–2424  ·  view source on GitHub ↗

take a -128..127 value and stbi__clamp it and convert to 0..255

Source from the content-addressed store, hash-verified

2414
2415// take a -128..127 value and stbi__clamp it and convert to 0..255
2416stbi_inline static stbi_uc stbi__clamp(int x)
2417{
2418 // trick to use a single test to catch both cases
2419 if ((unsigned int) x > 255) {
2420 if (x < 0) return 0;
2421 if (x > 255) return 255;
2422 }
2423 return (stbi_uc) x;
2424}
2425
2426#define stbi__f2f(x) ((int) (((x) * 4096 + 0.5)))
2427#define stbi__fsh(x) ((x) * 4096)

Callers 1

stbi__idct_blockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected