From: Marcel Holtmann <marcel@holtmann.org>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] endianess question
Date: Fri, 07 Apr 2006 17:11:34 +0200 [thread overview]
Message-ID: <1144422695.2625.18.camel@aeonflux.holtmann.net> (raw)
In-Reply-To: <1144405107.13072.10.camel@localhost.localdomain>
Hi Martin,
> whenever I take data out of a socket buffer using the get_unaligned()
> function like this:
> u16 control = get_unaligned((u16 *) skb->data);
> do I have to worry about endianess correctness if I need to do some bit
> fiddling stuff?
> For example:
> The specification states that all packet formats shall use little-endian
> byte order, so an iframe is denoted like the following:
> | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 09 | 08 | 07 06 05 04 03 02 01
> |---SAR---|------------ReqSeq-----------|-R--| ...
>
> if I need to pull the ReqSeq value out of the 16 Bits, do I need to make
> use of a function like __btoh(control):
> u16 reqseq = (__btoh16(control) & 0x3F00) >> 8;
> or is it enough to say:
> u16 reqseq = (control & 0x3F00) >> 8;
> when I took the get_unaligned() function?
the get_unaligned() macro has nothing to do with the endian thing. So
you still need to convert from little endian into machine byte order.
Regards
Marcel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
prev parent reply other threads:[~2006-04-07 15:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-07 10:18 [Bluez-devel] endianess question Martin Röhricht
2006-04-07 15:11 ` Marcel Holtmann [this message]
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=1144422695.2625.18.camel@aeonflux.holtmann.net \
--to=marcel@holtmann.org \
--cc=bluez-devel@lists.sourceforge.net \
/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