Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1536841
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Sebastian Frias <sf84@laposte.net> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] add equivalent of BIT(x) for bitfields |
| Date | Tue, 06 Dec 2016 11:40:02 +0100 |
| Message-ID | <sLlke-Rj-25@gated-at.bofh.it> (permalink) |
| References | <sL5yO-7xB-29@gated-at.bofh.it> <sL6bv-84q-13@gated-at.bofh.it> |
| X-Original-To | Linus Torvalds <torvalds@linux-foundation.org> |
| Dkim-Signature | v=1; a=rsa-sha256; c=simple/simple; d=laposte.net; s=mail0; t=1481019002; bh=+c9h9gwJS4HmXWcBNh/+zZtyQWmFo7/jlhwHNvFiaBk=; h=Subject:To:References:Cc:From:Date:In-Reply-To; b=BKOVpGQVpDcdKcdN9JQD3Atsm3Qz9cMLrtNF+LevIIOwkmCEQM83W+yC138aJ/PgW RKhlirlJhWmJ364AUgFD2ok2SBp8FD9kqkWy0pC8lpl1jxpkvM6TDxUdn6pDeagbnW /lp4KMdef8aEfThr7Q5q5zTGGEHrjaZZFf/45dYvIg3ESNsUXFz8SgbJOfFhu41qqC JUtLM/M2PvyHHQE8BdvJgIhZmmmi7QvgslgiGpKxxfvHvo4pblxk9n4WFT7w2FNso7 XFK7wE5IMCLfIp8/a9dA5W6OCZ9Qv7LGm4Tbim/PAe16F/sNtZrepSr3cuoEuPcoyo lJ/fJKzq/oUjA== |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Vr-Srcip | 92.154.11.170 |
| X-Vr-Score | -100 |
| X-Vr-Cause-1 | gggruggvucftvghtrhhoucdtuddrfeelfedrhedtgddtvdcutefuodetggdotefrodftvfcurfhrohhf |
| X-Vr-Cause-2 | ihhlvgemucfntefrqffuvffgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhs |
| X-Vr-Cause-3 | ucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpefu |
| X-Vr-Cause-4 | vggsrghsthhirghnucfhrhhirghsuceoshhfkeegsehlrghpohhsthgvrdhnvghtqeenucfkphepledv |
| X-Vr-Cause-5 | rdduheegrdduuddrudejtdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopegludej |
| X-Vr-Cause-6 | vddrvdejrddtrddvudegngdpihhnvghtpeelvddrudehgedruddurddujedtpdhmrghilhhfrhhomhep |
| X-Vr-Cause-7 | shhfkeegsehlrghpohhsthgvrdhnvghtpdhrtghpthhtohepthhorhhvrghlughssehlihhnuhigqdhf |
| X-Vr-Cause-8 | ohhunhgurghtihhonhdrohhrgh |
| X-Vr-Avstate | No |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 27 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | zijun_hu <zijun_hu@htc.com>, Andrew Morton <akpm@linux-foundation.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Mason <slash.tmp@free.fr>, Harvey Harrison <harvey.harrison@gmail.com>, Borislav Petkov <bp@alien8.de> |
| X-Original-Date | Tue, 6 Dec 2016 11:10:02 +0100 |
| X-Original-Message-ID | <9d74aaf8-a328-a3a6-dcaa-9ade95538241@laposte.net> |
| X-Original-References | <93523b80-6033-bafa-c1ec-4bc2c3f9c53b@laposte.net> <CA+55aFx2WSredqeGRJpjwhJme8zopNa54MaA3R30AGGHU+sY2Q@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1536841 |
Show key headers only | View raw
On 05/12/16 19:23, Linus Torvalds wrote: > On Mon, Dec 5, 2016 at 9:49 AM, Sebastian Frias <sf84@laposte.net> wrote: >> Introduce GENVALUE(msb, lsb, value) macro to ease dealing with >> continuous bitfields, just as BIT(x) does for single bits. > > Oh, and looking at the implementation, this is wrong. You use "lsb" > twice, so it mustn't have side effects. > > That's fine for all expected users (since you'd expect that the only > real use of this is with constant values for msb/lsb), Yes, that's what I thought. >but please add > actual checking. Sure! Thanks for the advice. > > You can use BUILD_BUG_ON_ZERO(!__builtin_constant_p(x)) or something. > That returns zero, so it's easy to use in expressions. Done. v3 of the patch is submitted. > > Linus >
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2] add equivalent of BIT(x) for bitfields Sebastian Frias <sf84@laposte.net> - 2016-12-05 18:50 +0100
Re: [PATCH v2] add equivalent of BIT(x) for bitfields Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-05 19:30 +0100
Re: [PATCH v2] add equivalent of BIT(x) for bitfields Sebastian Frias <sf84@laposte.net> - 2016-12-06 11:40 +0100
csiph-web