From 422ffba1598f4b2ae5a1861dc140ec3d1775e1c1 Mon Sep 17 00:00:00 2001 From: Vladimir Levijev Date: Fri, 6 Nov 2015 07:35:41 +0000 Subject: ...G...... [ZBX-2966] move ZBX_IS_TOP_BIT_SET macro sysinfo.h -> zbxtypes.h --- include/zbxtypes.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/zbxtypes.h') diff --git a/include/zbxtypes.h b/include/zbxtypes.h index d89395cfcbd..1ae1500b289 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -163,4 +163,7 @@ zbx_uint128_t; #define ZBX_SIZE_T_ALIGN8(size) (((size) + 7) & ~(size_t)7) +/* macro to test if a signed value has been assigned to unsigned type (char, short, int, long long) */ +#define ZBX_IS_TOP_BIT_SET(x) (0 != ((__UINT64_C(1) << ((sizeof(x) << 3) - 1)) & (zbx_uint64_t)(x))) + #endif -- cgit v1.2.3 From 499ac329d9254155251bd5a4e5b4516743f9482c Mon Sep 17 00:00:00 2001 From: Andris Zeila Date: Fri, 6 Nov 2015 07:53:59 +0000 Subject: ...G...... [ZBX-2966] removed redundant cast to zbx_uint64_t in ZBX_IS_TOP_BIT_SET macro --- include/zbxtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/zbxtypes.h') diff --git a/include/zbxtypes.h b/include/zbxtypes.h index 1ae1500b289..a0dc1bce97c 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -164,6 +164,6 @@ zbx_uint128_t; #define ZBX_SIZE_T_ALIGN8(size) (((size) + 7) & ~(size_t)7) /* macro to test if a signed value has been assigned to unsigned type (char, short, int, long long) */ -#define ZBX_IS_TOP_BIT_SET(x) (0 != ((__UINT64_C(1) << ((sizeof(x) << 3) - 1)) & (zbx_uint64_t)(x))) +#define ZBX_IS_TOP_BIT_SET(x) (0 != ((__UINT64_C(1) << ((sizeof(x) << 3) - 1)) & (x))) #endif -- cgit v1.2.3