From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 924C47D06 for ; Sun, 19 Nov 2017 23:16:06 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id a132so8009190lfa.7 for ; Sun, 19 Nov 2017 14:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=sPw1G4/BPS/kMGr2OA4astqRRDMRnhf3kftMqVodMQ8=; b=GmH4gXbNMh5XFJPdwTYrw8jR9oLrt3ZSBrz33yZWLhrXXmtJcbgZsVpzC4ENbM1xX4 JUeY/Zjv8NPEgEa3b+/+IRmdQcvJtSefFRzP7opIDMNJooshGS9iwueYb9Vwlu+hVRor kbb2byVQZtDQGxlqijTNEUZtE8zzO187kDjm2MeBLpHL+qOU+GpEUt2wS3sJWtRtcg09 yPsaemUdHyWLe0BvJDVBLITOej2MgQ0yx4Z2eHidH2est0t2gMfJMltsagMhtKAwBpuh Fb8jhEZo1aVxva06C4EYwjU44wmJm+kun8nhN+2zzQksEXhcVXZFzM1KErt+UW+0SeXu TZHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sPw1G4/BPS/kMGr2OA4astqRRDMRnhf3kftMqVodMQ8=; b=QWyHpiYga629ecyFXJxVknL2vZ/91bJX6VBC3TP7YvfErlMPvKBEoX6YGOa0QlMXUO moDRS0k/cgULsRGZNax2TrC7QE205c1fNpjZgNB/XBT896r7/OWbMdHbO9GZHQ+YD75B mYCWe3OVKx6kngHOyNHxC1eXwt7twGIA9zBFuhQkea4lQF8XQn67NDGvMunaUpCfrnq+ jHdHSUJzCcfGcE/v9MeJ/T/goGCJm5buUw2htkgJbqG/GsOCiRteayzsC49Uxue50ey2 +7mFogJ0SmCIaOqHsanvUUdE/WzKhJCW+yedRiKxKZj/A8voXl6n6AGjI0kSnrMyWouc /NSQ== X-Gm-Message-State: AJaThX4bXRmgKarOtpPTW1hSdQGVIdGqpEMWr/6uX4aaHzTq4MG+iHuw /SvagwkqqYlicJ4gIxEVIcc= X-Google-Smtp-Source: AGs4zMYnqAK+0337Kh90ksiJOnEipBkv6U3D0Hf7pEhjFnGtgUaFpIg4yMyKIZQRedoMFwS+8YAMFQ== X-Received: by 10.25.20.81 with SMTP id k78mr3160824lfi.146.1511129766066; Sun, 19 Nov 2017 14:16:06 -0800 (PST) Received: from localhost.localdomain ([178.20.183.191]) by smtp.gmail.com with ESMTPSA id z68sm1542551lje.26.2017.11.19.14.16.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Nov 2017 14:16:05 -0800 (PST) From: Aleksey Baulin X-Google-Original-From: Aleksey Baulin To: Thomas Monjalon Cc: dev@dpdk.org Date: Mon, 20 Nov 2017 01:16:04 +0300 Message-Id: <1511129764-23123-1-git-send-email-Aleksey.Baulin@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] eal/common: better likely() and unlikely() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Nov 2017 22:16:06 -0000 A warning is issued when using an argument to likely() or unlikely() builtins which is evaluated to a pointer value, as __builtin_expect() expects a 'long int' type for its first argument. With this fix a pointer value is converted to an integer with the value of 0 or 1. Signed-off-by: Aleksey Baulin --- lib/librte_eal/common/include/rte_branch_prediction.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/include/rte_branch_prediction.h b/lib/librte_eal/common/include/rte_branch_prediction.h index a6a56d1..2e7dc69 100644 --- a/lib/librte_eal/common/include/rte_branch_prediction.h +++ b/lib/librte_eal/common/include/rte_branch_prediction.h @@ -50,7 +50,7 @@ * */ #ifndef likely -#define likely(x) __builtin_expect((x),1) +#define likely(x) __builtin_expect(!!(x), 1) #endif /* likely */ /** @@ -64,7 +64,7 @@ * */ #ifndef unlikely -#define unlikely(x) __builtin_expect((x),0) +#define unlikely(x) __builtin_expect(!!(x), 0) #endif /* unlikely */ #endif /* _RTE_BRANCH_PREDICTION_H_ */ -- 2.7.4