[riot-devel] C Bitfields and network_uint16_t

Martine Lenders authmillenon at gmail.com
Sat Mar 21 22:14:50 CET 2015


Hi Simon,
you can use network_uint16_t as integer by accessing it's u16 member, but
since bitfields are usually accessed using bit-arithmetics anyways I'm
wondering if it makes so much sense to use network_uint16_t, since they are
primarily used to warn about byteorder issues.

Cheers,
Martine

2015-03-21 21:01 GMT+01:00 Simon <brummer.simon at googlemail.com>:

> Hi Everyone,
>
> I am trying to define the Header Datastructure for the new TCP
> implementation. I'd like to use C Bitfields in structs for the Control
> Bits and would like to use the Type of network_uint16_t (That seems to
> be common for most other Header Structures). My compiler tells me that
> thats not possible because network_uint16_t is not an integer type.
>
> In Byteorder.h it shows that its actually a union. Has anyone an Idea to
> solve this issue? I would really like to use only network types in my
> structure.
>
> Thanks in advance.
>
> Yours sincerly
>         Simon Brummer
>
>
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> http://lists.riot-os.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20150321/9f41dc54/attachment.html>


More information about the devel mailing list