Skip to content

Instantly share code, notes, and snippets.

@juanarzola
Created December 20, 2010 22:15
Show Gist options
  • Save juanarzola/749094 to your computer and use it in GitHub Desktop.
Save juanarzola/749094 to your computer and use it in GitHub Desktop.
// defines...
#define SECTION_AND_ROW_INT(section, row) (row | section << 16)
#define SECTION_AND_ROW_FOR_FIRST_NAME SECTION_AND_ROW_INT(0, 0)
#define SECTION_AND_ROW_FOR_LAST_NAME SECTION_AND_ROW_INT(0, 1)
#define SECTION_AND_ROW_FOR_AGE SECTION_AND_ROW_INT(1, 0)
// ...
// sample switch
int sectionAndRow = SECTION_AND_ROW_INT(section, row);
switch(sectionAndRow){
case SECTION_AND_ROW_FOR_FIRST_NAME:{
//...
break;
}
case SECTION_AND_ROW_FOR_LAST_NAME:{
//...
break;
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment