Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using integers when limiting output pixel values
static inline UINT8
clip8(float in) {
int out = (int) in;
if (out >= 255)
return 255;
if (out <= 0)
return 0;
return (UINT8) out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.