//+---------------------------------------------------------------------------- // // File: macros.h // // Module: // // Synopsis: // // Copyright (C) 2003 // // Created: sgasch 10 Oct 2003 // //+---------------------------------------------------------------------------- #ifndef _MACROS_H_ #define _MACROS_H_ // // Macros // #define ARRAY_LENGTH(a) (sizeof((a)) / sizeof((a)[0])) #define MIN(x, y) (((x) < (y)) ? (x) : (y)) #define MAX(x, y) (((x) > (y)) ? (x) : (y)) #if 1 void _assert(CHAR *, CHAR *, ULONG); void VideoPrint(CHAR *, ...); #define ASSERT(x) if (x) \ { ; } \ else \ { _assert(__FUNCTION__ , \ __FILE__ , \ __LINE__); } #define TRACE(f, ...) VideoPrint("%s:%u> " ##f , __FUNCTION__ , \ __LINE__ , ##__VA_ARGS__) #else #define ASSERT(x) ; #define TRACE(f, ...) ; #endif // DEBUG #define CURRENT_STAMP(a) asm volatile("rdtsc" : "=a"(((unsigned int *)(a))[0]), "=d"(((unsigned int *)a)[1])) #endif /* _MACROS_H_ */