bitfield diagram - interpretation welcomed!

Discussion in 'C Programming' started by Doug, May 18, 2007.

  1. Doug

    Doug Guest

    Hi all,

    A workmate was recently bitching to me about an RFC.

    (Apologies - the RFC number eludes me at present (it's related to the
    DIAMETER protocol, that's all I can remember) but I will try to find
    out and update the thread.)

    He was moaning how the RFC laid out the description of an 8-bit
    field. According to him, the diagram was (fixed-width font required,
    but it won't really matter, and I've omitted the schematic-like use of
    -,| and + that the RFCs usually use):

    0 1 2 3 4 5 6 7
    F F X X X Y Y Y P

    The odd thing for him (and me) was the ordering of the bit numbers in
    the diagram - increasing from left to right. According to him, there
    was absolutely no description of what this diagram meant. In other
    words, is the 0-bit in the diagram the Most Significant Bit, or the
    Least Significant Bit?

    We work with network protocol specfications, so suffice to say this
    lack of precision was surprising to him (and on his relaying the
    story, is surprising to me). He has already found products during
    interop testing with the two different interpretations.

    This is apparently an early draft of the RFC, and he will be
    requesting clarification, but I was wondering what your people's take
    on it was? How would you intepret this?

    Thanks in advance,
    Doug
     
    Doug, May 18, 2007
    #1
    1. Advertising

  2. Doug

    Doug Guest

    On 18 May, 21:08, Doug <> wrote:

    <snip>

    > 0 1 2 3 4 5 6 7
    > F F X X X Y Y Y P


    Ahem, please ignore the 'P'. 'P'retend it isn't there.

    Thanks,
    Doug
     
    Doug, May 18, 2007
    #2
    1. Advertising

  3. In article <>,
    Doug <> wrote:
    > Hi all,


    > A workmate was recently bitching to me about an RFC.


    > (Apologies - the RFC number eludes me at present (it's related to the
    > DIAMETER protocol, that's all I can remember) but I will try to find
    > out and update the thread.)


    > He was moaning how the RFC laid out the description of an 8-bit
    > field. According to him, the diagram was (fixed-width font required,
    > but it won't really matter, and I've omitted the schematic-like use of
    > -,| and + that the RFCs usually use):


    > 0 1 2 3 4 5 6 7
    > F F X X X Y Y Y P


    > The odd thing for him (and me) was the ordering of the bit numbers in
    > the diagram - increasing from left to right. According to him, there
    > was absolutely no description of what this diagram meant. In other
    > words, is the 0-bit in the diagram the Most Significant Bit, or the
    > Least Significant Bit?



    It doesn't matter, bit 0 is always the lowest.

    HTH

    --
    Mitch


    www.sand-hill.freeserve.co.uk/terminal_crazy
     
    Terminal Crazy, May 18, 2007
    #3
  4. Doug

    Doug Guest

    Ahem,

    Please ignore me completely. The bitfield diagram appears within a
    PDU diagram, the bit numbering is completely normal for an RFC.

    My apologies for wasting your time and bandwidth.

    Doug
     
    Doug, May 18, 2007
    #4
  5. Doug

    Ben Pfaff Guest

    Terminal Crazy <> writes:

    > In article <>,
    >> The odd thing for him (and me) was the ordering of the bit numbers in
    >> the diagram - increasing from left to right. According to him, there
    >> was absolutely no description of what this diagram meant. In other
    >> words, is the 0-bit in the diagram the Most Significant Bit, or the
    >> Least Significant Bit?

    >
    > It doesn't matter, bit 0 is always the lowest.


    Most of the world agrees, but IBM mainframers number their bits
    "backward", so that bit 0 is the MSB.
    --
    Comp-sci PhD expected before end of 2007
    Seeking industrial or academic position *outside California* in 2008
     
    Ben Pfaff, May 18, 2007
    #5
  6. Doug

    Doug Guest

    On 18 May, 21:43, Terminal Crazy <Terminal_Cr...@sand-
    hill.freeserve.co.uk> wrote:
    > In article <>,
    > Doug <> wrote:
    >
    >
    >
    >
    >
    > > Hi all,
    > > A workmate was recently bitching to me about an RFC.
    > > (Apologies - the RFC number eludes me at present (it's related to the
    > > DIAMETER protocol, that's all I can remember) but I will try to find
    > > out and update the thread.)
    > > He was moaning how the RFC laid out the description of an 8-bit
    > > field. According to him, the diagram was (fixed-width font required,
    > > but it won't really matter, and I've omitted the schematic-like use of
    > > -,| and + that the RFCs usually use):
    > > 0 1 2 3 4 5 6 7
    > > F F X X X Y Y Y P
    > > The odd thing for him (and me) was the ordering of the bit numbers in
    > > the diagram - increasing from left to right. According to him, there
    > > was absolutely no description of what this diagram meant. In other
    > > words, is the 0-bit in the diagram the Most Significant Bit, or the
    > > Least Significant Bit?

    >
    > It doesn't matter, bit 0 is always the lowest.
    >
    > HTH
    >
    > --
    > Mitch


    Hi Mitch,

    Thanks for your reply.

    Actually, in this case - and I thought the same as you when my
    workmate described this to me - bit 0 in that diagram is actually the
    MSB. The context I was missing (but have since found in a code
    comment) is that it appears within an RFC digram of a PDU. These
    diagrams assume 8 bit bytes, and are written left to right 0, 1,
    2, ... usually to 32/64, so the diagram lines up nicely over multiple
    rows. The numbering doesn't reflect the MSB/LSB ordering - the right-
    most bit in each octet in the diagram is still the LSB.

    Sorry for any confusion!

    Thanks,
    Doug
     
    Doug, May 18, 2007
    #6
  7. Doug

    Flash Gordon Guest

    Ben Pfaff wrote, On 18/05/07 22:18:
    > Terminal Crazy <> writes:
    >
    >> In article <>,
    >>> The odd thing for him (and me) was the ordering of the bit numbers in
    >>> the diagram - increasing from left to right. According to him, there
    >>> was absolutely no description of what this diagram meant. In other
    >>> words, is the 0-bit in the diagram the Most Significant Bit, or the
    >>> Least Significant Bit?

    >> It doesn't matter, bit 0 is always the lowest.

    >
    > Most of the world agrees, but IBM mainframers number their bits
    > "backward", so that bit 0 is the MSB.


    It's not only IBM that use 0 as the MSB. To confuse things further I've
    seen documents numbering bits from 1.

    Moral of the story, always read the full specification and never assume
    you know what it will say in advance.
    --
    Flash Gordon
     
    Flash Gordon, May 18, 2007
    #7
  8. Doug

    Barry Guest

    "CBFalconer" <> wrote in message
    news:...
    > Ben Pfaff wrote:
    >> Terminal Crazy <> writes:
    >>> In article <>,
    >>>
    >>>> The odd thing for him (and me) was the ordering of the bit
    >>>> numbers in the diagram - increasing from left to right.
    >>>> According to him, there was absolutely no description of what
    >>>> this diagram meant. In other words, is the 0-bit in the diagram
    >>>> the Most Significant Bit, or the Least Significant Bit?
    >>>
    >>> It doesn't matter, bit 0 is always the lowest.

    >>
    >> Most of the world agrees, but IBM mainframers number their bits
    >> "backward", so that bit 0 is the MSB.

    >
    > Also the HP3000.
    >


    Of course C was not the language of choice on the HP3000. :)
     
    Barry, May 19, 2007
    #8
  9. Doug

    Barry Guest

    "Ben Pfaff" <> wrote in message
    news:...
    > Terminal Crazy <> writes:
    >
    >> In article <>,
    >>> The odd thing for him (and me) was the ordering of the bit numbers in
    >>> the diagram - increasing from left to right. According to him, there
    >>> was absolutely no description of what this diagram meant. In other
    >>> words, is the 0-bit in the diagram the Most Significant Bit, or the
    >>> Least Significant Bit?

    >>
    >> It doesn't matter, bit 0 is always the lowest.

    >
    > Most of the world agrees, but IBM mainframers number their bits
    > "backward", so that bit 0 is the MSB.


    Which is precisely why the protocols are not defined based upon
    the architecture of the transceivers. CBFalconer has stated below
    that the HP3000 was "backward", but the network devices
    connected to its system bus were not necessarily :).
     
    Barry, May 19, 2007
    #9
  10. Barry wrote:
    >
    > "CBFalconer" <> wrote in message
    > news:...
    > > Ben Pfaff wrote:

    [...]
    > >>> It doesn't matter, bit 0 is always the lowest.
    > >>
    > >> Most of the world agrees, but IBM mainframers number their bits
    > >> "backward", so that bit 0 is the MSB.

    > >
    > > Also the HP3000.

    >
    > Of course C was not the language of choice on the HP3000. :)


    My first exposure to computers was, I believe, an HP-3000. I forget
    the exact model number. I never actually saw the machine, either,
    as it was in some other city at the other end of a telephone line.
    The only language we had access to was some primitive form of BASIC.

    On the other hand, I still recall the login:

    HELLO-B669,<password>

    (I still use that password on some systems.)

    --
    +-------------------------+--------------------+-----------------------+
    | Kenneth J. Brody | www.hvcomputer.com | #include |
    | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
    +-------------------------+--------------------+-----------------------+
    Don't e-mail me at: <mailto:>
     
    Kenneth Brody, May 21, 2007
    #10
  11. Doug

    Richard Guest

    Terminal Crazy <> writes:

    > In article <>,
    > Doug <> wrote:
    >> Hi all,

    >
    >> A workmate was recently bitching to me about an RFC.

    >
    >> (Apologies - the RFC number eludes me at present (it's related to the
    >> DIAMETER protocol, that's all I can remember) but I will try to find
    >> out and update the thread.)

    >
    >> He was moaning how the RFC laid out the description of an 8-bit
    >> field. According to him, the diagram was (fixed-width font required,
    >> but it won't really matter, and I've omitted the schematic-like use of
    >> -,| and + that the RFCs usually use):

    >
    >> 0 1 2 3 4 5 6 7
    >> F F X X X Y Y Y P

    >
    >> The odd thing for him (and me) was the ordering of the bit numbers in
    >> the diagram - increasing from left to right. According to him, there
    >> was absolutely no description of what this diagram meant. In other
    >> words, is the 0-bit in the diagram the Most Significant Bit, or the
    >> Least Significant Bit?

    >
    >
    > It doesn't matter, bit 0 is always the lowest.


    Did you mean the least significant? Not so.

    I came across some IBM stuff recently where bit 0 was the MSB. Really. I
    was shocked.
     
    Richard, May 21, 2007
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anton Spaans
    Replies:
    2
    Views:
    689
    Anton Spaans
    Oct 19, 2005
  2. Guotao Luan
    Replies:
    11
    Views:
    689
    Markus Dehmann
    Jun 16, 2004
  3. zb32

    bitfield optimizations

    zb32, Jul 13, 2004, in forum: C++
    Replies:
    1
    Views:
    1,102
    David Harmon
    Jul 13, 2004
  4. Nije Nego

    Comments welcomed

    Nije Nego, Aug 7, 2006, in forum: HTML
    Replies:
    7
    Views:
    495
    Nije Nego
    Aug 19, 2006
  5. Replies:
    7
    Views:
    150
    Michele Dondi
    Jun 16, 2007
Loading...

Share This Page