From: Jakub Kicinski <kubakici@wp.pl>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] Add primitives for manipulating bitfields both in host- and fixed-endian.
Date: Thu, 14 Dec 2017 21:07:13 -0800 [thread overview]
Message-ID: <20171214210713.6be03d43@cakuba.netronome.com> (raw)
In-Reply-To: <20171215023343.GG21978@ZenIV.linux.org.uk>
Looks great to me!
On Fri, 15 Dec 2017 02:33:43 +0000, Al Viro wrote:
> The following primitives are defined in linux/bitfield.h:
>
> * u32 le32_get_bits(__le32 val, u32 field) extracts the contents of the
> bitfield specified by @field in little-endian 32bit value @val and
> converts it to host-endian.
>
> * void le32p_replace_bits(__le32 *p, u32 v, u32 field) replaces
> the contents of the bitfield specified by @field in little-endian
> 32bit object pointet to by *p with the value of @v. New value is
> given in host-endian and stored as little-endian.
>
> * __le32 le32_replace_bits(__le32 old, u32 v, u32 field) is equivalent to
> ({__le32 tmp = old; le32p_replace_bits(&old, v, field); tmp;})
> In other words, instead of modifying an object in memory, it takes
> the initial value and returns the modified one.
the current macros take filed/mask as first param, not sure if it's
worth maintaining the order
next prev parent reply other threads:[~2017-12-15 5:07 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-10 4:53 [RFC][PATCH] apparent big-endian bugs in dwc-xlgmac Al Viro
2017-12-11 4:33 ` Jie Deng
2017-12-11 5:05 ` Al Viro
2017-12-11 5:38 ` Al Viro
2017-12-11 6:46 ` Jie Deng
2017-12-11 15:54 ` [RFC][PATCH] new byteorder primitives - ..._{replace,get}_bits() Al Viro
2017-12-12 4:02 ` Jakub Kicinski
2017-12-12 6:20 ` Al Viro
2017-12-12 19:45 ` Al Viro
2017-12-12 20:04 ` Jakub Kicinski
2017-12-12 23:48 ` Al Viro
2017-12-12 23:59 ` Jakub Kicinski
2017-12-13 0:36 ` Al Viro
2017-12-13 1:04 ` Jakub Kicinski
2017-12-13 1:30 ` Al Viro
2017-12-13 1:35 ` Jakub Kicinski
2017-12-13 1:51 ` Al Viro
2017-12-13 2:44 ` Jakub Kicinski
2017-12-13 14:22 ` Al Viro
2017-12-13 17:45 ` Al Viro
2017-12-15 2:33 ` [RFC][PATCH] Add primitives for manipulating bitfields both in host- and fixed-endian Al Viro
2017-12-15 5:07 ` Jakub Kicinski [this message]
2017-12-15 5:34 ` Al Viro
2017-12-15 16:48 ` [RFC][PATCH v2] " Al Viro
2017-12-13 19:04 ` [RFC][PATCH] new byteorder primitives - ..._{replace,get}_bits() Jakub Kicinski
2017-12-11 6:18 ` [RFC][PATCH] apparent big-endian bugs in dwc-xlgmac Jie Deng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171214210713.6be03d43@cakuba.netronome.com \
--to=kubakici@wp.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.