From 03a7b946e2cc28254c5e44959e2be4037b8ef2c6 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Fri, 5 Jan 2018 20:59:04 +0100 Subject: [PATCH] print_fields.h: add PRINT_FIELD_U_CAST Add a macro for printing fields explicitly casted to specific type. This is useful for bit fields, as otherwise the magic of *_extend_to_* macros breaks. * print_field.h (PRINT_FIELD_U_CAST): New macro. --- print_fields.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/print_fields.h b/print_fields.h index b78e09a1..0af087aa 100644 --- a/print_fields.h +++ b/print_fields.h @@ -44,6 +44,10 @@ STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \ zero_extend_signed_to_ull((where_).field_)) +#define PRINT_FIELD_U_CAST(prefix_, where_, field_, type_) \ + STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \ + zero_extend_signed_to_ull((type_) (where_).field_)) + #define PRINT_FIELD_X(prefix_, where_, field_) \ STRACE_PRINTF("%s%s=%#llx", (prefix_), #field_, \ zero_extend_signed_to_ull((where_).field_))