Skip to content

Instantly share code, notes, and snippets.

@garethlewin
Created February 6, 2014 20:50
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 garethlewin/8852237 to your computer and use it in GitHub Desktop.
Save garethlewin/8852237 to your computer and use it in GitHub Desktop.
//This is a define I see all the time
#define MAKE_FOURCC( ch0, ch1, ch2, ch3 ) \
( (unsigned int)(unsigned char)(ch0) | ( (unsigned int)(unsigned char)(ch1) << 8 ) | \
( (unsigned int)(unsigned char)(ch2) << 16 ) | ( (unsigned int)(unsigned char)(ch3) << 24 ) )
// and I just don't get it, why prefer
uint32_t myFourCC = MAKE_FOURCC('a', 'b', 'c', 'd');
// over
uint32_t myFourceCC = 'abcd';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment