From d1f7f07b180f153f0eb40e54230537e8495871e9 Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Mon, 13 Jun 2011 00:26:58 +0200 Subject: [PATCH] Added debugging macros GP_GET_BITS_DBG and GP_SET_BITS_DBG --- include/core/GP_Common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/core/GP_Common.h b/include/core/GP_Common.h index 48a11676..cda19672 100644 --- a/include/core/GP_Common.h +++ b/include/core/GP_Common.h @@ -141,6 +141,12 @@ #define GP_GET_BITS(offset, count, val) ( ( (val)>>(offset) ) & ( ((((typeof(val))1)<<(count)) - 1) ) ) /* + * Debugging version, evaluates args twice. + */ +#define GP_GET_BITS_DBG(offset, count, val) ( printf("GET_BITS(%d, %d, 0x%x)=%d", offset, count, val, \ + GP_GET_BITS(offset, count, val)), GP_GET_BITS(offset, count, val)) + +/* * Set count bits of dest at ofset to val (shifted by offset) * * Does not check val for overflow @@ -160,6 +166,14 @@ GP_SET_BITS_OR(offset, dest, val); \ } while (0) +/* + * Debugging version, evaluates args twice. + */ +#define GP_SET_BITS_DBG(offset, count, dest, val) do { \ + GP_SET_BITS(offset, count, dest, val); \ + printf("SET_BITS(%d, %d, p, %d)\n", offset, count, val); \ + } while (0) + /* Determines the sign of the integer value; it is +1 if value is positive, * -1 if negative, and 0 if it is zero. -- 2.11.4.GIT