From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by dpdk.org (Postfix) with ESMTP id F28F81B19B for ; Mon, 2 Oct 2017 12:16:18 +0200 (CEST) Received: by mail-wr0-f179.google.com with SMTP id p10so1695419wrc.6 for ; Mon, 02 Oct 2017 03:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scylladb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=uCTqQWDXswHNaSwdRATptfYLCShCzk/RpItZldxgSWE=; b=g5RmTZRqw2l0gSWsus+iYLZ7L7g8ofCQQwSZIrMTNxzmpFivRVuKGFLzuplQwE51dN VC3I6i2m9DqlVimoCXF5C92f/WtvndwRWfA43DKjtR49GK3ftXLhFRG0DnYiGYRbcAdk QNkK16RsIh9/6bbRG2cu3lVXsENTbo8/Gaofiu2U51JTzaW4RKZpZoltHGaWLHPScNeL dXd2ntFm6j0ivxUjMehAqNoC69BK+Qdpy0hX5TOMqzDH3ijkAA7Xv7f2vm7sDSxifYRx W6HcVJrJRv3BAtfPMYgQ52sHKYtgpx6WGUNIiRnbp4rQ5CJlGK3mkVVy303OnSGlvt1p unqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=uCTqQWDXswHNaSwdRATptfYLCShCzk/RpItZldxgSWE=; b=BuUr98LYGDlu+xH+0f3WOQ83KtxEdZQplJ2xoNbwqreJNsS3SvmfiOLQ6FesLJnuY5 a7YXAJfi//6MJ0dTOlxIRhO9tJ4ErIgAG1XA/4I/kCuovOYriWHF+3avD2MD2WNML6eO mHNHDqxw//fuZdvy+hNy2cAQKNIdtpX7W1lD6HGBdSo4a7144CDQqgdyWrTzPorW2TJA n1i/QS4XCPADzx5bkkvDsyJtEjBjFrXYHdKCtJ5/xd90bH54e3XmtFExN6hpr89tlXEJ nChzYdu3UDaDWS1qd5VTPSTVopgmuxVLk8/cVRwV/orz6eTobnjqrweMlhPQCiioXVb7 Y3zg== X-Gm-Message-State: AMCzsaXLE0zMpZwmgMRKjgL7lpA/B62BlBCLTrIE95MdN+wXPUM7FyGm YWj6HZi5LFPMSNHZl3u4C6H8Jw== X-Google-Smtp-Source: AOwi7QD1NQXWk24cvPNfblLcKWqRlbye1cRfwO0DqRydHcZBcmdUmndyza23hKD9Tf8wgE4W7DsU6A== X-Received: by 10.223.146.101 with SMTP id 92mr6164900wrj.21.1506939378621; Mon, 02 Oct 2017 03:16:18 -0700 (PDT) Received: from avi.cloudius-systems.com ([77.138.249.123]) by smtp.gmail.com with ESMTPSA id b89sm27682445wrd.42.2017.10.02.03.16.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 03:16:17 -0700 (PDT) To: Shreyansh Jain , dev@dpdk.org Cc: ferruh.yigit@intel.com, hemant.agrawal@nxp.com References: <1497591668-3320-1-git-send-email-shreyansh.jain@nxp.com> <1497591668-3320-2-git-send-email-shreyansh.jain@nxp.com> From: Avi Kivity Organization: ScyllaDB Message-ID: <59a745a1-f686-7075-a6b2-9ea40de3e603@scylladb.com> Date: Mon, 2 Oct 2017 13:16:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1497591668-3320-2-git-send-email-shreyansh.jain@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH 01/38] eal: add support for 24 40 and 48 bit operations 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: Mon, 02 Oct 2017 10:16:19 -0000 On 06/16/2017 08:40 AM, Shreyansh Jain wrote: > From: Hemant Agrawal > > Bit Swap and LE<=>BE conversions for 23, 40 and 48 bit width > > Signed-off-by: Hemant Agrawal > --- > .../common/include/generic/rte_byteorder.h | 78 ++++++++++++++++++++++ > 1 file changed, 78 insertions(+) > > diff --git a/lib/librte_eal/common/include/generic/rte_byteorder.h b/lib/librte_eal/common/include/generic/rte_byteorder.h > index e00bccb..8903ff6 100644 > --- a/lib/librte_eal/common/include/generic/rte_byteorder.h > +++ b/lib/librte_eal/common/include/generic/rte_byteorder.h > @@ -122,6 +122,84 @@ rte_constant_bswap64(uint64_t x) > ((x & 0xff00000000000000ULL) >> 56); > } > > +/* > + * An internal function to swap bytes of a 48-bit value. > + */ > +static inline uint64_t > +rte_constant_bswap48(uint64_t x) > +{ > + return ((x & 0x0000000000ffULL) << 40) | > + ((x & 0x00000000ff00ULL) << 24) | > + ((x & 0x000000ff0000ULL) << 8) | > + ((x & 0x0000ff000000ULL) >> 8) | > + ((x & 0x00ff00000000ULL) >> 24) | > + ((x & 0xff0000000000ULL) >> 40); > +} > + Won't something like bswap64(x << 16) be much more efficient? Two instructions for the non-constant case, compared to 15-20 here.