From cd475ca07a219de7a5d0665852878d1938d3f598 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Thu, 17 Oct 2024 16:11:15 +0200 Subject: [PATCH] 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. --- common/utils/T/T.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/utils/T/T.h b/common/utils/T/T.h index 6d781241a5..07919e843a 100644 --- a/common/utils/T/T.h +++ b/common/utils/T/T.h @@ -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;