Skip to content

Instantly share code, notes, and snippets.

@zao
Created December 12, 2014 21:58
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 zao/6301202690a820912f3c to your computer and use it in GitHub Desktop.
Save zao/6301202690a820912f3c to your computer and use it in GitHub Desktop.
table building hack
#define MAKE_TABLE \
BUILD_TABLE_ENTRY(50, 1) \
BUILD_TABLE_ENTRY(100, 2) \
BUILD_TABLE_ENTRY(250, 5) \
BUILD_TABLE_ENTRY(500, 10) \
BUILD_TABLE_ENTRY(1500, 30) \
BUILD_TABLE_ENTRY(3000, 1*60) \
BUILD_TABLE_ENTRY(6000, 2*60) \
BUILD_TABLE_ENTRY(15000, 5*60) \
BUILD_TABLE_ENTRY(30000, 10*60) \
BUILD_TABLE_ENTRY(90000, 30*60)
#define BUILD_TABLE_ENTRY(Duration, Skip) (Duration),
int64_t skip_durations[] = {
MAKE_TABLE
};
#undef BUILD_TABLE_ENTRY
#define BUILD_TABLE_ENTRY(Duration, Skip) (Skip),
double skip_amount[] = {
MAKE_TABLE
};
#undef BUILD_TABLE_ENTRY
#define BUILD_TABLE_ENTRY(Duration, Skip) 1+
size_t num_entries = MAKE_TABLE 0;
#undef BUILD_TABLE_ENTRY
#undef MAKE_TABLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment