[riot-devel] bitfeilds

Martine Lenders mail at martine-lenders.eu
Thu Oct 27 13:35:21 CEST 2016


Hi,
because this discussion came up in one of my (higher level) PRs, too.

2016-10-27 12:33 GMT+02:00 Neil Jones <neiljay at gmail.com>:

> are you suggesting the compiler generated code for accessing the bitfeilds
> is less size efficient than doing it manually? I would be suprised if that
> was the case ?
>
> On 27 Oct 2016 08:05, "Hauke Petersen" <hauke.petersen at fu-berlin.de>
> wrote:
>
>> Hi Neil, hi Kees,
>>
>> though named bitfields are kind of nice when it comes to code
>> readability, they behave very poorly when it comes to code size. This is
>> especially true for register maps, as these are typically volatile. For
>> this reason, we don't use them in RIOT and I strongly advice not to use
>> those.
>>
>> As example I was able to save several 100 bytes of ROM when removing the
>> named bitfield use from the samr21s peripheral drivers.
>
>
I don't know about your specific code, but I was able to show, that a
bitfield actually *saves* ROM [1].

Cheers,
Martine

[1] https://github.com/RIOT-OS/RIOT/pull/5866#issuecomment-249801576
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20161027/dd6015e7/attachment.html>


More information about the devel mailing list