From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v4 1/4] Add RIB library Date: Thu, 26 Apr 2018 15:18:12 -0700 Message-ID: <20180426151812.52015da7@xeon-e3> References: <1524780214-23196-1-git-send-email-medvedkinv@gmail.com> <1524780214-23196-2-git-send-email-medvedkinv@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, bruce.richardson@intel.com, thomas@monjalon.net, cristian.dumitrescu@intel.com To: Medvedkin Vladimir Return-path: Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by dpdk.org (Postfix) with ESMTP id 781FD7EE3 for ; Fri, 27 Apr 2018 00:18:15 +0200 (CEST) Received: by mail-pf0-f195.google.com with SMTP id g14so19443991pfh.3 for ; Thu, 26 Apr 2018 15:18:15 -0700 (PDT) In-Reply-To: <1524780214-23196-2-git-send-email-medvedkinv@gmail.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 27 Apr 2018 01:03:31 +0300 Medvedkin Vladimir wrote: > +/** > + * Check if prefix1 {key1/depth1} > + * is covered by prefix2 {key2/depth2} > + */ > +static inline int __attribute__((pure)) > +rte_rib_is_covered(uint32_t key1, uint8_t depth1, uint32_t key2, uint8_t depth2) > +{ > + return ((((key1 ^ key2) & rte_rib_depth_to_mask(depth2)) == 0) > + && (depth1 > depth2)); > +} Use standard boolean type (bool) for these kind of functions. Plus you really don't need the pure attribute for static (or inline) functions since compiler determines that itself.