On Tue, Jan 24, 2017 at 01:41:56PM +0100, Szymon Janc wrote:
> Hi Will,
> 
> On 23 January 2017 at 18:43, will sanfilippo <[email protected]> wrote:
> >
> > Szymon:
> >
> > Indeed, those endianness macros were put in ble.h because they were 
> > non-standard and acted on a buffer as opposed to just swapping bytes. 
> > Internally (quite some time ago) we debated using packed structures for  
> > PDU protocol elements and we just never ended up deciding on what to do 
> > throughout the code. We did figure if we went the packed structure route 
> > the macros used (htole16) would get replaced with ones that just byte swap 
> > (if needed).
> 
> Yeap, I'll work on that (starting with SM code).
> 
> >
> > I looked over the changes and they look good to me. With these changes we 
> > should also go through the code and use packed structures elsewhere. This 
> > will definitely save a bunch of code as there will be no swapping since the 
> > protocol and host are little endian.
> 
> OK, I'm sending pull request.
> 
> > I think there are also macros in the host for endianness-related functions. 
> > Not sure if they have been renamed/replaced.
> 
> From what I see host and controller are using same endianness helpers.
> I'll convert any missing code if stumble upon.

There are some (horrifically-named) endianness macros in
net/nimble/host/src/ble_hs_endian_priv.h.  These just do what your bswap
macros do, so they can probably be removed.

Chris

Reply via email to