[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] porting to arm

Hello, I have difficulties to port the rfcomm part of the sources to arm.

In fact, I think we are in trouble as soon as we use bitfields (which are
often used in RFCOMM) e.g in a structure :

typedef struct example
	u8 one:1;
	u8 seven:7;
	u8* data;

I think this causes problems when we use Type Cast :

example* ex;
u8* data={...};

ex = (struct example*) data;

Is this last line safe ?
I don't think so as I often lose a part of the data pointed to by "data".
I think it is depending on the compiler you use and the way it "understands"
the bitfields.

Have you ever face this problem ?
If so, how did you solve it ? using macros (masks and >>, <<) ?

The use of bitfields is easy and quite readable and I wonder if there are
any other ways to do it.

Thanks in advance.

MikaŽl Prod'homme <mailto:mikael.prodhomme@xxxxxxx.fr> - Software Engineer
WAVECOM S.A. <http://www.wavecom.fr/>
39 rue du gouverneur general Eboue
92442 ISSY les Moulineaux (FRANCE)
Tel : +33 (0)1 46 29 08 00, extension 930
Cellular: (+33) 06 13 55 63 54

To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com