From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E2E1A04F6; Sat, 21 Dec 2019 19:08:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4F2091C01; Sat, 21 Dec 2019 19:08:05 +0100 (CET) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 6474A1B05 for ; Sat, 21 Dec 2019 19:08:04 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id l24so6651731pgk.2 for ; Sat, 21 Dec 2019 10:08:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pgqAiJLd0nH35P5Kkp0eh/Agg9u+0QOtgmn75vIkQ7Q=; b=JyVjOZw1bX6k7kNbzo7MU2NGCfCsx/rbrhBiAmA1INxJqbD6VRO8kFCAMMeMzlwppA 4FsR/VYRRwI9QkGEtMIeLNHRD12dxBh5UYodr4AdwzbIJndSQ88Jd+S8ZPqnwjLI/oxZ 1jLGTtyeSfcGEGBKHCHLqUk91OZYSqsYmJTRZ2yUxAoq/Oi+fH/zI6FkLAVxWBQs547B eldCmS/oc/wKwsrNHW/7ocUFWiFGSFyyJkaAEZX5JRNFY10TGTSMk0aTSrCG9XkC1GIB /bko41GCB2yBI0kHDzwZ+HPF+5r+H5rRnB++Wh2toePYUz4cnLbIjFAahn8qvxmeU96/ 9gMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pgqAiJLd0nH35P5Kkp0eh/Agg9u+0QOtgmn75vIkQ7Q=; b=XRlxEBrY/iKiEBD+s/hre51vS8FKg4hSL575e8mtPjtTF7f0OkJ+04nIrO7YttabMh EPjDBVg8l21KxrIouxvLV1HZuFGqQoFap2IQkiYbBQONUoEMGqT7Gy0AsiKUZ5hdK7EQ yTe9X1O4Ze/ywrBtSdDbXVDSx21kIN9nbl6U675I2w/NxYEkZqXrBSMg1ssvL5isWp6z 89fb8gel9GNleBUUG/fapsXYy6NihivYw6JrpiAfIoaEc99fBwMchMFzKLmbgxIPhYaZ 5KZZAT5Ox7pt7/wVQKmZAa6jC56HMUMbbrhMbg4+e20BwAytdBtEWojekQYdDQQlWIVV 7CEQ== X-Gm-Message-State: APjAAAXBXW6wRH14JwmAO5QMkKTcYPUdHQ5sx3v8oTcbxhblScMSA2iK rR2yRuE9UPih6dTl42UEP20VSA== X-Google-Smtp-Source: APXvYqzCbxA/KhDwvVWP+7KUWSIUShS9cUm9MT7LuAL4xR6C64lSs7BJtR3CsPBZruqukP/hok2SSg== X-Received: by 2002:a63:9d4e:: with SMTP id i75mr21657024pgd.231.1576951683313; Sat, 21 Dec 2019 10:08:03 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id g8sm17630918pfh.43.2019.12.21.10.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Dec 2019 10:08:03 -0800 (PST) Date: Sat, 21 Dec 2019 10:07:52 -0800 From: Stephen Hemminger To: Honnappa Nagarahalli Cc: Joyce Kong , "thomas@monjalon.net" , "david.marchand@redhat.com" , "mb@smartsharesystems.com" , "jerinj@marvell.com" , "bruce.richardson@intel.com" , "ravi1.kumar@amd.com" , "rmody@marvell.com" , "shshaikh@marvell.com" , "xuanziyang2@huawei.com" , "cloud.wangxiaoyun@huawei.com" , "zhouguoyang@huawei.com" , Phil Yang , Gavin Hu , nd , "dev@dpdk.org" Message-ID: <20191221100752.04838f7a@hermes.lan> In-Reply-To: References: <1571125801-45773-1-git-send-email-joyce.kong@arm.com> <1576648808-24765-2-git-send-email-joyce.kong@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 1/6] lib/eal: implement the family of rte bit operation APIs 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sat, 21 Dec 2019 16:07:23 +0000 Honnappa Nagarahalli wrote: > Converting these into macros will help remove the size based duplication of APIs. I came up with the following macro: > > #define RTE_GET_BIT(nr, var, ret, memorder) \ > ({ \ > if (sizeof(var) == sizeof(uint32_t)) { \ > uint32_t mask1 = 1U << (nr)%32; \ > ret = __atomic_load_n(&var, (memorder)) & mask1;\ > } \ > else {\ > uint64_t mask2 = 1UL << (nr)%64;\ > ret = __atomic_load_n(&var, (memorder)) & mask2;\ > } \ > }) Macros are more error prone. Especially because this is in exposed header file