From: Dan Malek <dan@netx4.com>
To: W4OQM@aol.com
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: Re^2: char type is unsigned with PPC gcc?
Date: Thu, 20 Apr 2000 11:34:36 -0400 [thread overview]
Message-ID: <38FF238C.C0DD8140@embeddededge.com> (raw)
In-Reply-To: c9.39dbd77.262faf77@aol.com
W4OQM@aol.com wrote:
> How about:
>
> #define BIT_8_OF_BYTE (1<<0)
> #define BIT_8_OF_WORD (1<<8)
> #define BIT_8_OF_LONG (1<<24)
Whoa there, youngster.....let the old man tell you a story.
There is computing equipment in the world where a byte is not
eight bits, a word is not two bytes, and so on.
Left to right (big endian) bit numbering works just fine on
these computers, as it does on all big endian machines.
On big endian byte ordered machines, you also want big endian
bit ordering. If I load some address as a byte, word, long word
or whatever, bit 6 is still bit 6. You probably don't remember
the bit instruction mess when Motorola added that to the '020......
If you had a programming language that supported bit array objects,
how would you index the array? How would that map into larger
objects?
> ... Personally, the left-to-right bit numbering drives me nuts.
That's because you are worried about the implementation details and
not solving the data communication application. Look at flow of
bits through a data communication system. Serial stream, left to
right. Start numbering bits anywhere, stop anywhere, left to right
makes perfect sense. Map any aribitary object on top of the bits,
still makes sense. Look at coding theory and the algorithms they
write...left to right bit ordering.
The 2^n bit numbering is a mathematical convenience that can be
easily hidden behind programming language macros or functions. I have
seen very little code make use of this convenience, while the real
world data, mathematics, and computer science theory usually use
big endian bit numbering.
> .... If God
> meant bit numbering to start on the left, she'd have started with 1.
You better read some of the bibles from the beginning of computer time.
Lots of smart people provided insights into these discussions a very
long time ago.
-- Dan
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next parent reply other threads:[~2000-04-20 15:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c9.39dbd77.262faf77@aol.com>
2000-04-20 15:34 ` Dan Malek [this message]
2000-04-20 21:38 ` Re^2: char type is unsigned with PPC gcc? Gabriel Paubert
2000-04-20 21:50 ` Dan Malek
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=38FF238C.C0DD8140@embeddededge.com \
--to=dan@netx4.com \
--cc=W4OQM@aol.com \
--cc=linuxppc-embedded@lists.linuxppc.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;
as well as URLs for NNTP newsgroup(s).