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:
Bartosz Podrygajlo
2024-10-17 16:11:15 +02:00
parent 65d8d410b5
commit cd475ca07a
+4
View File
@@ -92,7 +92,11 @@
struct T_header;
/* to define message ID */
#ifdef CHECK_T_TYPE
#define T_ID(x) ((struct T_header *)(uintptr_t)(x))
#else
#define T_ID(x) x
#endif
/* T macro tricks */
extern int T_stdout;