flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > (-1 xor CONST) != (CONST xor -1) |
Author |
|
Tomasz Grysztar 12 Jan 2009, 14:57
IronFelix wrote: Please, tell me, is it a bug: This should be: Code: dd (-1) xor 3 because what you wrote is the same as: Code: dd -(1 xor 3) Check out the operators precedence in manual. |
|||
12 Jan 2009, 14:57 |
|
IronFelix 12 Jan 2009, 15:07
Thanks for so quick reply and sorry for wasting your time, Tomasz.
|
|||
12 Jan 2009, 15:07 |
|
revolution 12 Jan 2009, 15:16
IronFelix wrote:
Tomasz Grysztar wrote: because what you wrote is the same as: |
|||
12 Jan 2009, 15:16 |
|
Tomasz Grysztar 12 Jan 2009, 15:20
revolution wrote: Isn't -(1 xor 3) ===> -(2) ===> 0xFFFFFFFE? And this is how fasm assembles it. Perhaps IronFelix made a mistake there. |
|||
12 Jan 2009, 15:20 |
|
IronFelix 12 Jan 2009, 15:46
Yes, it is my mistake, sorry for it too, please.
|
|||
12 Jan 2009, 15:46 |
|
IceStudent 03 Feb 2009, 22:00
Tomasz Grysztar wrote: Check out the operators precedence But it seems that XOR have higher priority than unary minus. But, by manual, it is not (minus have zero priority and XOR have 3rd). Is it a bug or feature? Another example: 1 - 1 xor 1 != 1 xor 1 - 1 But in other languages this expressions are equal (1 - 1 ^ 1 == 1 ^ 1 - 1) |
|||
03 Feb 2009, 22:00 |
|
Tomasz Grysztar 03 Feb 2009, 22:23
IceStudent wrote: But it seems that XOR have highest priority than unary minus. But, by manual, it is not (minus have zero priority and XOR have 3rd). Yes, XOR has higher priority than any minus (unary or binary), and this is exactly what manual states. The higher "priority" value gives a higher priority to operator, therefore operator with this value higher is processed first. IceStudent wrote: Another example: In some languages they may be equal, in some not. In fasm XOR is processed before substraction, as shown in the manual. |
|||
03 Feb 2009, 22:23 |
|
IceStudent 03 Feb 2009, 23:05
In the manual a higher priority haves largest value?
|
|||
03 Feb 2009, 23:05 |
|
revolution 04 Feb 2009, 00:53
IceStudent wrote: In the manual a higher priority haves largest value? |
|||
04 Feb 2009, 00:53 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.