Re: transmeta cpu code question

From: Eric Sandall
Date: Thu Nov 20 2003 - 01:59:15 EST


Quoting Ben Collins <bcollins@xxxxxxxxxx>:

> On Thu, Nov 20, 2003 at 03:02:18AM +0100, Nico Schottelius wrote:
> > Hello!
> >
> > What does this do:
> >
> > printk(KERN_INFO "CPU: Processor revision %u.%u.%u.%u,
> > %u MHz\n",
> > (cpu_rev >> 24) & 0xff,
> > (cpu_rev >> 16) & 0xff,
> > (cpu_rev >> 8) & 0xff,
> > cpu_rev & 0xff,
> > cpu_freq);
> >
> > (from arch/i386/kernel/cpu/transmeta.c)
> >
> > Does not & 0xff make no sense? 0 & 1 makes 0, 1 & 1 makes 1,
> > no changes.
> >
> > And I don't understand why we do this for 8bit and shifting the
> > cpu_rev...
>
> You are a bit confused. The cpu_rev is a 4 byte value, each byte is a
> decimal of the revision.
>
> And (0 & 1) makes 1, not 0. That's an AND, not an OR.

Last I checked, 0 AND anything is 0. Think of it this way:

A B A & B
------------
T F F
T T T
F T F
F F F

So, anything ANDed with F is false.

-sandalle

--
PGP Key Fingerprint: FCFF 26A1 BE21 08F4 BB91 FAED 1D7B 7D74 A8EF DD61
http://search.keyserver.net:11371/pks/lookup?op=get&search=0xA8EFDD61

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/E/IT$ d-- s++:+>: a-- C++(+++) BL++++VIS>$ P+(++) L+++ E-(---) W++ N+@ o?
K? w++++>-- O M-@ V-- PS+(+++) PE(-) Y++(+) PGP++(+) t+() 5++ X(+) R+(++)
tv(--)b++(+++) DI+@ D++(+++) G>+++ e>+++ h---(++) r++ y+
------END GEEK CODE BLOCK------

Eric Sandall | Source Mage GNU/Linux Developer
eric@xxxxxxxxxx | http://www.sourcemage.org/
http://eric.sandall.us/ | SysAdmin @ Inst. Shock Physics @ WSU
http://counter.li.org/ #196285 | http://www.shock.wsu.edu/

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/