From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Osterkamp Subject: [PATCH 01/10] consolidation of MIN and MAX macros in common.h Date: Mon, 22 Nov 2010 16:50:48 +0100 Message-ID: <1290441057-16729-2-git-send-email-jens@linux.vnet.ibm.com> References: <1290441057-16729-1-git-send-email-jens@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1290441057-16729-1-git-send-email-jens@linux.vnet.ibm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: e1000-eedc@lists.sourceforge.net, virtualization@lists.linux-foundation.org, evb@yahoogroups.com Cc: chrisw@redhat.com, Jens Osterkamp List-Id: virtualization@lists.linuxfoundation.org This patch consolidates a modified version of the already existing MIN macro in lldpad to include/common.h and add a MAX macro. Signed-off-by: Jens Osterkamp --- include/common.h | 14 ++++++++++++++ include/dcb_protocol.h | 4 ---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/common.h b/include/common.h index 01746ea..ab07dc2 100644 --- a/include/common.h +++ b/include/common.h @@ -387,4 +387,18 @@ typedef int socklen_t; const char * wpa_ssid_txt(u8 *ssid, size_t ssid_len); +#define MIN(x,y) \ + ({ \ + typeof (x) __x = (x); \ + typeof (y) __y = (y); \ + __x < __y ? __x : __y; \ + }) + +#define MAX(x,y) \ + ({ \ + typeof (x) __x = (x); \ + typeof (y) __y = (y); \ + __x > __y ? __x : __y; \ + }) + #endif /* COMMON_H */ diff --git a/include/dcb_protocol.h b/include/dcb_protocol.h index 63e2d3c..d7127f5 100644 --- a/include/dcb_protocol.h +++ b/include/dcb_protocol.h @@ -58,10 +58,6 @@ typedef enum { #define DUP_DCBX_TLV_LLINK 0x0020 #define TOO_MANY_NGHBRS 0x0040 -//#ifndef min /*todo: change to min() - #define MIN(x, y) ((x) < (y) ? x : y) -//#endif - #define INIT_DCB_OUI {0x00,0x1b,0x21} int add_adapter(char *device_name); -- 1.7.2.3