From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 5EA2618F for ; Fri, 16 Jan 2015 18:01:57 +0100 (CET) Received: by mail-wg0-f53.google.com with SMTP id x13so21578844wgg.12 for ; Fri, 16 Jan 2015 09:01:57 -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=FIGNLFEPT/O6xpRmdZzxGuZ5KMs0LhQ4siQ+FMHd7io=; b=mjuytGcFbDWw/nZc0Hm3v53nGoOxcd/YRv8WJTladXJXD+pK4DLg0LuAst7Vlueo0q sON7snMtXeE8Qo0hWG5LqesEw9X1H/M4/eX1Cqaa3/6apczHjJhJg5Tal+UkcU4q/DdQ +483CHB85EG/DrugaK257QyZOkNgPhN0ge6fuL8F3j1qJ3zZMJt3hdGdsgmgfz1Dxn+u inPW/dDxxgK1YM/S1Htm9k2rz+6sv7OpJTQ+rAnJ2IVm6o7Pu6gT++1QPNerWbQiqNHw NNZnOB302bdDcEMHoDzyqleQazfS26eczyzOZeaEY2Rnbr/iMoA31e3puZJxufbk2DmM iSUQ== X-Gm-Message-State: ALoCoQmNalu845vBCTc2UGbD6K+xMfX4wiTrSn72m8cTDRsZnVdp6BfRRhBeUIlowvwAi4gUEw9C X-Received: by 10.194.57.43 with SMTP id f11mr30085899wjq.6.1421427717203; Fri, 16 Jan 2015 09:01:57 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id ni15sm3718679wic.18.2015.01.16.09.01.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jan 2015 09:01:56 -0800 (PST) From: Thomas Monjalon To: Declan Doherty Date: Fri, 16 Jan 2015 18:01:32 +0100 Message-ID: <1555477.4KJeR5JQaW@xps13> Organization: 6WIND User-Agent: KMail/4.14.3 (Linux/3.17.6-1-ARCH; KDE/4.14.3; x86_64; ; ) In-Reply-To: <1421421030-22261-1-git-send-email-declan.doherty@intel.com> References: <1421421030-22261-1-git-send-email-declan.doherty@intel.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] eal / malloc : alignment parameter check failing due to changes in rte_is_power_of_2 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: Fri, 16 Jan 2015 17:01:57 -0000 2015-01-16 15:10, Declan Doherty: > In commit 2fc8d6d the behaviour of function rte_is_power_of_2 was > changed to not return true for 0. memzone_reserve_aligned_thread_unsafe > and rte_malloc_socket both make the assumption that for align = 0 > !rte_is_power_of_2(align) will return false. This patch adds a check > that align parameter is non-zero before doing the power of 2 check > > Signed-off-by: Declan Doherty [...] > - if (!rte_is_power_of_2(align)) { > + if (align ? !rte_is_power_of_2(align) : 0) { [...] > - if (size == 0 || !rte_is_power_of_2(align)) > + if (size == 0 || align ? !rte_is_power_of_2(align) : 0) I don't understand why you write "align ? !rte_is_power_of_2(align) : 0" instead of the more readable "align && !rte_is_power_of_2(align)" ? Pablo acked it so I guess there is something obvious I'm missing. -- Thomas