File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Operator precedence

 
Divya Eknath
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody please tell me the precedence of bitwise/ligical operators:&,^ and |?
In some books its given as & ^ |, while in others it is & | ^.
 
wise owen
Ranch Hand
Posts: 2023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
&,^, |

Expressions, Statements, and Blocks
 
Simeon Cherniy
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The order is: & ^ |
x^y = (x | !y) & (!x | y)
That's why the priority of XOR(^) is higher
 
Simeon Cherniy
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
x^y = (x | y) & (!x | !y)
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic