Skip to content

Instantly share code, notes, and snippets.

@luctrudeau
Created March 13, 2018 02:07
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/efb7ce02baecf91e06dbd6ebaffca627 to your computer and use it in GitHub Desktop.
Save luctrudeau/efb7ce02baecf91e06dbd6ebaffca627 to your computer and use it in GitHub Desktop.
HiColorAverage
uint16_t hicolor_avg(uint16_t a, uint16_t b) {
const uint16_t s = a ^ b;
return ((s & 0xF7DEU) >> 1) + (a & b) + (s & 0x0821U);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment