From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id 90DAF3F9 for ; Wed, 17 Dec 2014 15:27:49 +0100 (CET) Received: by mail-wg0-f45.google.com with SMTP id b13so20384580wgh.32 for ; Wed, 17 Dec 2014 06:27:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=67y2OEKDcPVhUIcgi+1MlN0vcOrUz5gaEHE0q6eUtHM=; b=FwMtrdgmEiF7L/eS9c1NvJIkAxojl5/EJ2Q3qTT2p1hh0L4615Zr7kE1WlZ5MvS/Ie yjzAEsmHGcfZGg67Du92Pk9y56Uc84uCJiBnSrUDdZ51jRC3XDrlcQdDKURBD8Ev5ZCO oZglHk7hqNw//+5cx667GDyylrKpSwRozzGJ2811tMWZfAcppJe+TwIXt2kBKlIM7hot ZbOJfXy2j+BY/Oe4QYYR1SkVniPkIlmKLefvCBTOV7k5DxINB+ulegYDzJn7GI+lN9cs OqCchCGykqz9hBirgdQsBthHLCUz5MIWH/LpebudUR9ZPko/Grx/yyKAnASiHtxUw1QF cF3w== X-Gm-Message-State: ALoCoQlNngOEW28IeI0aR4HSK1I6TreATxMQZ/JAMS+FRoMxbLtDd8OveC/8EBy/7S0ovWlK3N/u X-Received: by 10.180.76.211 with SMTP id m19mr15124721wiw.73.1418826469457; Wed, 17 Dec 2014 06:27:49 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id h8sm6336858wiy.17.2014.12.17.06.27.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Dec 2014 06:27:48 -0800 (PST) From: Thomas Monjalon To: Jay Rolette Date: Wed, 17 Dec 2014 15:27:23 +0100 Message-ID: <1667884.VTnHUhe7ya@xps13> Organization: 6WIND User-Agent: KMail/4.14.3 (Linux/3.17.4-1-ARCH; KDE/4.14.3; x86_64; ; ) In-Reply-To: <1418823077-9129-1-git-send-email-rolette@infiniteio.com> References: <1418823077-9129-1-git-send-email-rolette@infiniteio.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] replaced O(n^2) sort in sort_by_physaddr() with qsort() from standard library X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Dec 2014 14:27:50 -0000 Hi Jay, Please read http://dpdk.org/dev#send for submission guidelines. A description of why you do it would be welcome in the commit log. > +static int > +cmp_physaddr(const void *a, const void *b) > +{ > +#ifndef RTE_ARCH_PPC_64 > + const struct hugepage_file *p1 = (const struct hugepage_file *)a; > + const struct hugepage_file *p2 = (const struct hugepage_file *)b; > +#else > + // PowerPC needs memory sorted in reverse order from x86 Comments shall be C-style (/* */). > + const struct hugepage_file *p1 = (const struct hugepage_file *)b; > + const struct hugepage_file *p2 = (const struct hugepage_file *)a; > +#endif > + if (p1->physaddr < p2->physaddr) > + return -1; > + else if (p1->physaddr > p2->physaddr) > + return 1; > + else > + return 0; > +} One of the goal of EAL is to avoid #ifdef. So that function would probably be better located in lib/librte_eal/common/include/arch/* with different implemenations depending of the architecture. -- Thomas