Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@luctrudeau
Created March 20, 2018 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luctrudeau/458e879941d6b6ae1633bfd9d11e8591 to your computer and use it in GitHub Desktop.
Save luctrudeau/458e879941d6b6ae1633bfd9d11e8591 to your computer and use it in GitHub Desktop.
Hi Color Avg No Rounding
uint16_t hicolor_avg(uint16_t a, uint16_t b) {
const uint16_t s = a ^ b;
return ((s & 0xF7DEU) >> 1) + (a & b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment