So this leads to the follow on question (now that I've got the precedence 
straight): suppressif 8|8 == 0x8 is an illegal statement.

 in IFR (8 8 EFI_IFR_EQUAL 8 EFI_IFR_BITWISE_OR) since EFI_IFR_EQUAL results in 
a BOOLEAN, but EFI_IFR_BITWISE_OR requires an integer, and IFR is strongly 
typed.

In Laszlo's original analysis:   8|(8 == 0x8) means   8|1

The specification says:

This opcode performs the following actions:
1. Pop two expressions from the expression stack.
2. If the two expressions cannot be evaluated as unsigned integers, push 
Undefined.
3. Otherwise, zero-extend the unsigned integers to 64-bits.
4. Perform a bitwise-OR of the two values.
5. Push the result.

There is no implicit type conversion in IFR, so in order for VfrCompile.exe to 
handle this expression, I would expect a EFI_IFR_TO_BOOLEAN to be generated 
implicitly. But in my analysis of the IFR being generated, it is not.

In fact, an optimizer tool we have written catches these as errors, along with 
the fact that the suppressif expression is not evaluating to a bool.

Tim

-----Original Message-----
From: Tim Lewis [mailto:tim.le...@insyde.com] 
Sent: Thursday, August 28, 2014 5:53 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Bitwise OR operator problems

Laszlo --

You are correct. I have verified the VFR grammar which has similar priority.

It is actually the behavior for integer conversion in suppressif that is 
confusing me, not the order of evaluation like I thought.

Tim

-----Original Message-----
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Thursday, August 28, 2014 5:43 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Bitwise OR operator problems

On 08/28/14 11:31, Laszlo Ersek wrote:

> In the C language, both operator & and operator | bind
> *less* strongly than operator ==.

(Sorry for following up on my own email.) I found some references:

http://en.wikipedia.org/wiki/Operator_precedence_in_C#Criticism_of_bitwise_and_equality_operators_precedence

http://cm.bell-labs.com/cm/cs/who/dmr/chist.html

See under "Neonatal C".

Thanks
Laszlo

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to