Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Mar 2011 21:50:10 +0100
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Frank Solensky <frank@solensky.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Bit order == byte order??
Message-ID:  <20110303205010.GA47653@owl.midgard.homeip.net>
In-Reply-To: <910E776A-D865-4F78-8BE5-E974326636D0@solensky.org>
References:  <910E776A-D865-4F78-8BE5-E974326636D0@solensky.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Thu, Mar 03, 2011 at 11:26:12AM -0500, Frank Solensky wrote:
> In sys/netinet/ip.h, the first octet of the ip header structure tests
> the byte ordering to determine the ordering of the header length
> (ip_hl) and version (ip_v) fields.
> 
> My question: that always works?  While my reading of the language
> specification document leaves both the ordering of the bits within a
> byte and the bytes within a longer field as implementation choices,
> the two are independent of each other.
> 
> I haven't run into a CPU where this assumption was proven incorrect.
> It just surprised me to see that recently

Unless you have a CPU where memory is addressed bit-by-bit rather than
byte-by-byte the ordering of bits within a byte is not only completely
irrelevant, it is also pretty much impossible to determine
programatically.


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20110303205010.GA47653>