Subject: Re: Bitfields and kernel
To: Mike Cheponis <mac@Wireless.Com>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 09/30/1999 22:29:24
At 09:57 PM 9/30/99 , Mike Cheponis wrote:
>I like:  if ((msr&POW_BIT) && !(msr&ILE_BIT)) or
>
>          if (msr.pow && !msr.ile)
>
>
>Let the compiler smash the logicals & bits together efficiently.

But it can't.  The C language specifies that msr.pow if evaluates to
false then !msr.ile must not be evaluated.  This is so you can do

         if (foo != NULL && foo->bar)

Things get even nastier if you through volatile into the mess.
-- 
Matt Thomas               Internet:   matt@3am-software.com
3am Software Foundry      WWW URL:    http://www.3am-software.com/bio/matt/
Cupertino, CA             Disclaimer: I avow all knowledge of this message