Re: Big Endian Byte Ordering

From: Jonathan Wood (jwood_at_softcircuits.com)
Date: 01/11/05


Date: Tue, 11 Jan 2005 10:03:49 -0700

Well, I'm not sure exactly what the parameters are of a structure that
could be used for network protocols, but my users will be able to specify
byte padding, if they want it. As near as I can tell from Scott's response,
padding will work the same regardless of byte ordering.

-- 
Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm
"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:uHuzHqT9EHA.2180@TK2MSFTNGP10.phx.gbl...
> If this is a network protocol structure, pay special attention to Scott's
> advice about packing.  if you need strict absolute field offsets from the
> start of the structure, you will need probably set the packing level to 1.
>
> d
>
> -- 
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
> "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message
> news:O03eBXS9EHA.1260@TK2MSFTNGP12.phx.gbl...
> > Jonathan Wood wrote:
> >> I have a question about big-endian byte ordering.
> >>
> >> I know that with, for example, a WORD value, big endian byte ordering
> >> puts
> >> the two bytes in the reverse order that little endian does, which is
used
> >> by
> >> Intel processors.
> >>
> >> What I don't know is what happens in the case of structures. For
example,
> >> I
> >> know each member in the structure has its bytes reversed. But are all
> >> bytes
> >> of the structure reversed?
> >>
> >> I'm trying to figure out how to convert a structure data type fo big
> >> endian
> >> and I don't know if I can simply reverse all the bytes, or if I need to
> >> do
> >> something more complicated like just reverse the bytes of each member.
> >>
> >> Thanks for any tips!
> >>
> >
> > The endian-ness affects individual members only and is determined by the
> > CPU.  Structure packing and arrangement is determined by the compiler.
> >
> > -- 
> > Scott McPhillips [VC++ MVP]
> >
>
>


Relevant Pages

  • Re: Big Endian Byte Ordering
    ... could be used for network protocols, but my users will be able to specify ... >>> I know that with, for example, a WORD value, big endian byte ordering ... >>> and I don't know if I can simply reverse all the bytes, ... >>> something more complicated like just reverse the bytes of each member. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Big Endian Byte Ordering
    ... could be used for network protocols, but my users will be able to specify ... >>> I know that with, for example, a WORD value, big endian byte ordering ... >>> and I don't know if I can simply reverse all the bytes, ... >>> something more complicated like just reverse the bytes of each member. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Big Endian Byte Ordering
    ... you will need probably set the packing level to 1. ... >> the two bytes in the reverse order that little endian does, ... >> something more complicated like just reverse the bytes of each member. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Big Endian Byte Ordering
    ... you will need probably set the packing level to 1. ... >> the two bytes in the reverse order that little endian does, ... >> something more complicated like just reverse the bytes of each member. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Big Endian Byte Ordering
    ... you will need probably set the packing level to 1. ... >> the two bytes in the reverse order that little endian does, ... >> something more complicated like just reverse the bytes of each member. ...
    (microsoft.public.vc.mfc)

Loading