Optimize T_ID() macro
This changes the way T_IDs are defined. The T_ID macro was using a integer to pointer cast in order to provide type safety. This trick disables some compiler optimizations, as explained here: https://clang.llvm.org/extra/clang-tidy/checks/performance/no-int-to-ptr.html. Removing the type cast reenables the compiler optimizations.
This commit is contained in:
@@ -92,7 +92,11 @@
|
|||||||
struct T_header;
|
struct T_header;
|
||||||
|
|
||||||
/* to define message ID */
|
/* to define message ID */
|
||||||
|
#ifdef CHECK_T_TYPE
|
||||||
#define T_ID(x) ((struct T_header *)(uintptr_t)(x))
|
#define T_ID(x) ((struct T_header *)(uintptr_t)(x))
|
||||||
|
#else
|
||||||
|
#define T_ID(x) x
|
||||||
|
#endif
|
||||||
|
|
||||||
/* T macro tricks */
|
/* T macro tricks */
|
||||||
extern int T_stdout;
|
extern int T_stdout;
|
||||||
|
|||||||
Reference in New Issue
Block a user