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

Re: [bluetooth-dev] Re: Porting to ARM



The code would be really cluttered by that.. as far as possible it's
better to let gcc handle this, after all that's what a compiler is for. 

I think the packed attribute in combination with ntohl/htonl (or
corresponding macros suggested in this thread) would suffice..

Someone could check that the ARM GCC really does do the Right Thing when
accessing a packed struct with > byte size but I think it does and in that
case we won't need the mess with manual byte accesses.

BTW are the bluetooth protocol headers really that messed up that they've
designed them without alignment in mind (i.e they are suboptimally
processed by most architectures?)

-Bjorn

On Fri, 22 Sep 2000, Erwin Authried wrote:
> I think a clean solution that solves the alignment- as well as
> the endianness problems is a rewrite that uses macros similar to the
> samba implementation:
> 
> * instead of structures, make #defines of the byte offsets:
> #define xy 27
> #define ...
> 
> * use macros to set/read values:
> SSVAL(buffer,xy,value) instead of buffer->xy=value
> and ... = SVAL(buffer,xy)
> 
> There are a lot of changes necessary, but that's propably unavoidable for
> a really portable solution.
> 
> Regards,
> 
> Erwin
> 
>