All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Sean Young <sean@mess.org>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] media: rc: reduce size of struct ir_raw_event
Date: Thu, 17 Mar 2016 20:37:13 +0100	[thread overview]
Message-ID: <56EB0769.7000704@gmail.com> (raw)
In-Reply-To: <20160317105340.GA10247@gofer.mess.org>

Am 17.03.2016 um 11:53 schrieb Sean Young:
> On Thu, Mar 17, 2016 at 07:40:59AM +0100, Heiner Kallweit wrote:
>> Am 16.03.2016 um 23:28 schrieb Sean Young:
>>> On Wed, Mar 16, 2016 at 10:18:38PM +0100, Heiner Kallweit wrote:
>>>> +	u8		pulse:1;
>>>> +	u8		reset:1;
>>>> +	u8		timeout:1;
>>>> +	u8		carrier_report:1;
>>>
>>> Why are you changing the type of the bitfields? 
>>>
>> I did this to make sure that the compiler uses one byte for
>> the bit field. When testing gcc also used just one byte when
>> keeping the original "unsigned" type for the bit field members.
>> Therefore it wouldn't be strictly neeeded.
>>
>> But I'm not sure whether it's guaranteed that the compiler packs a
>> bit field to the smallest possible data type and we can rely on it.
>> AFAIK C99 is a little more specific about this implementation detail of
>> bit fields but C89/C90 is used for kernel compilation.
> 
> It might be worth reading about structure packing rules rather than
> guessing.
> 
Whenever it became interesting when reading the statement was:
unspecified / implementation-dependent.
But at least C90 clearly states that only signed / unsigned int are
acceptable for bit fields. Therefore leave the bit field as it is.
I will provide a v2.

Heiner
> 
> Sean
> 


      reply	other threads:[~2016-03-17 19:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 21:18 [PATCH] media: rc: reduce size of struct ir_raw_event Heiner Kallweit
2016-03-16 22:28 ` Sean Young
2016-03-17  6:40   ` Heiner Kallweit
2016-03-17 10:53     ` Sean Young
2016-03-17 19:37       ` Heiner Kallweit [this message]

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=56EB0769.7000704@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=sean@mess.org \
    /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.