Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCHv6 hcidump 2/4] add fixed channel definitions
Date: Sun, 23 Oct 2011 22:32:06 +0200	[thread overview]
Message-ID: <20111023203206.GA7538@fusion.localdomain> (raw)
In-Reply-To: <20111021104818.GA3934@aemeltch-MOBL1>

Hi Andrei,

On Fri, Oct 21, 2011, Emeltchenko Andrei wrote:
> Would the following code be OK?
> 
> diff --git a/lib/bluetooth.h b/lib/bluetooth.h
> index b0680e2..158103b 100644
> --- a/lib/bluetooth.h
> +++ b/lib/bluetooth.h
> @@ -125,6 +125,30 @@ do {                                               \
>         __p->__v = (val);                       \
>  } while(0)
>  
> +#if __BYTE_ORDER == __LITTLE_ENDIAN
> +inline uint64_t bt_get_le64(void *ptr)
> +{
> +       return bt_get_unaligned((uint64_t *) ptr);
> +}
> +
> +inline uint64_t bt_get_be64(void *ptr)
> +{
> +       return bswap_64(bt_get_unaligned((uint64_t *) ptr));
> +}
> +#elif __BYTE_ORDER == __BIG_ENDIAN
> +inline uint64_t bt_get_le64(void *ptr)
> +{
> +       return bswap_64(bt_get_unaligned((uint64_t *) ptr));
> +}
> +
> +inline uint64_t bt_get_be64(void *ptr)
> +{
> +       return bt_get_unaligned((uint64_t *) ptr);
> +}
> +#else
> +#error "Unknown byte order"
> +#endif
> +

Yes, I think that would be fine, but please also add the same for 32 and
16 bit integers.

Johan

  reply	other threads:[~2011-10-23 20:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20  8:30 [PATCHv6 hcidump 0/4] decode fixed channels Emeltchenko Andrei
2011-10-20  8:30 ` [PATCHv6 hcidump 1/4] add btohll macro Emeltchenko Andrei
2011-10-20  8:30 ` [PATCHv6 hcidump 2/4] add fixed channel definitions Emeltchenko Andrei
2011-10-21  8:36   ` Johan Hedberg
2011-10-21 10:48     ` Emeltchenko Andrei
2011-10-23 20:32       ` Johan Hedberg [this message]
2011-10-20  8:30 ` [PATCHv6 hcidump 3/4] get_uint64 helper Emeltchenko Andrei
2011-10-20  8:30 ` [PATCHv6 hcidump 4/4] decode fixed channel list info rsp Emeltchenko Andrei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111023203206.GA7538@fusion.localdomain \
    --to=johan.hedberg@gmail.com \
    --cc=Andrei.Emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox