This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: setting BI operands


Frank Ch. Eigler writes:
 > Hi -
 > 
 > On Mon, Nov 06, 2000 at 08:55:53AM +1100, Ben Elliston wrote:
 > : No, it doesn't work as expected.  If I set a BI to the value of newc, I get
 > : the 8-bit value of newc, not a 0 or a 1.  This leads to unpredictable
 > : results when later interrogating cbit.
 > 
 > In other words, it is the use of a BI variable as an rvalue that is the
 > problem.  Perhaps the right approach then is to forbid coercion from BI
 > to *INT, or to define it formally (such as "int foo = ! ! bar;").

I think(*1) we want BI to mean 0/1.
Hence I would turn that around and say

BI bar = !!foo;

Conversions from BI to *INT are ok.
Conversions from *INT to BI require the !! (your dead :-).

(*1): meaning that's my gut feeling.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]