Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!rutgers!sri-unix!sri-spam!ames!oliveb!sun!scherzo!lyang
From: lyang%scherzo@Sun.COM (Larry Yang)
Newsgroups: comp.unix.wizards,comp.arch
Subject: Re: Power-of-2 (Was : *Why* 8-bit bytes?)
Message-ID: <23967@sun.uucp>
Date: Wed, 22-Jul-87 13:21:54 EDT
Article-I.D.: sun.23967
Posted: Wed Jul 22 13:21:54 1987
Date-Received: Fri, 24-Jul-87 05:54:05 EDT
References: <142700010@tiger.UUCP> <2792@phri.UUCP> <8315@utzoo.UUCP> <2807@phri.UUCP>
Sender: news@sun.uucp
Reply-To: lyang@sun.UUCP (Larry Yang)
Organization: Sun Microsystems, Mountain View
Lines: 21
Xref: mnetor comp.unix.wizards:3362 comp.arch:1661

In article <2807@phri.UUCP> roy@phri.UUCP (Roy Smith) writes:
>
>	Second (sort of the inverse of question #1), why do modern machines
>have such a strong trend towards having power-of-2 word and byte lengths?

One reason I can think for having power-of-2 sizes is in terms of addressing.
If a word = 4 bytes, then I can address a word by masking out the lower
2 bits.  If a word were 5 bytes, this would be more difficult.  I can fill
a 64-byte cache line by masking out the lower 6 bits of the address.  And
so on.  This doesn't explain why a byte size has to be 8 bits, however.

Of course, this touches off the issue of word-aligned and double-word
aligned, which I don't even *want* to think about...

================================================================================


--Larry Yang [lyang@sun.com,{backbone}!sun!lyang]|   A REAL _|> /\ |
  Sun Microsystems, Inc., Mountain View, CA      | signature |   | | /-\ |-\ /-\
    Hobbes: "Why do we play war and not peace?"  |          <|_/ \_| \_/\| |_\_|
    Calvin: "Too few role models."               |                _/          _/