This commit is contained in:
Joseph Poirier 2015-07-06 04:17:31 -05:00
parent 6ed4aa1b63
commit e1f6569393

View file

@ -18,6 +18,28 @@
#define max(a, b) (((a) > (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b))
#endif #endif
*/ */
/* Get the name of a type */
// #define typename(x) _Generic((x), \
// _Bool: "_Bool", \
// unsigned char: "unsigned char", \
// char: "char", \
// signed char: "signed char", \
// short int: "short int", \
// unsigned short int: "unsigned short int", \
// int: "int", \
// unsigned int: "unsigned int", \
// long int: "long int", \
// unsigned long int: "unsigned long int", \
// long long int: "long long int", \
// unsigned long long int: "unsigned long long int", \
// float: "float", \
// double: "double", \
// long double: "long double", \
// char *: "pointer to char", \
// void *: "pointer to void", \
// int *: "pointer to int", \
// default: "other") (x)
#define MEM_ALIGN(x) (((x) + sizeof(ALIGN_TYPE)-1) & ~(sizeof(ALIGN_TYPE)-1)) #define MEM_ALIGN(x) (((x) + sizeof(ALIGN_TYPE)-1) & ~(sizeof(ALIGN_TYPE)-1))